my application is consuming huge amount of memory and CPU

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Venkatesha
    New Member
    • Mar 2008
    • 1

    my application is consuming huge amount of memory and CPU

    Hi All,

    I wrote a sample windows application in C#, which contains a data class which has 2 float values and 3 bool values.

    public class DataPoints
    {
    float xval;
    float yval;
    bool typ1;
    bool typ2;
    bool type3;
    }

    I am creating 1152000 instances of this class and keeping it in array. while loading application am looping through all these objects...and displaying the contents in listbox.

    When I run my application, CPU utilization is 97% and memory is 98MB.

    Why is my application taking so high CPU and memory?

    my second question:

    also, as a test, I replaced class with structure for my DataPoints. this is taking 1% CPU and 5MB memory.

    what is the difference between using struct and class for storiing bunch of values?
Working...