.NET 2.0 memory management problem

nemetzk

New member
Joined
Aug 11, 2008
Messages
3
Programming Experience
1-3
Hi!
I 've a communication class for a human interface application. It contains an adapter part for LumenWorks cvs reader dll to reading out the memory registers and the symbolic variable names from a csv file. These registers will be read out from the plc by serial port. The class creates the command frame based on these variables. I useed collections for the variable structures to be read out and another collection for the objects that are refreshed by the values from plc via serial port.
The main problem is that, the memory usage of this application is increasing continously read out from task manager. Please write me some solutions about how to "kill" dispose finalize from the memory a class a structure and a collection.
Thanks Kristian
 
You can basically only read an approximation of real memory usage when minimizing application window. You will never be able to read real memory usage because this is managed by the framework which uses all kinds of performance optimization and garbage collection tricks.
 
Thanks!
It's good to know, but the main memory is 256 mb the os is an embedded xp which is installed on a 1gb CF. When I start my ap the the "estimated" memory usage is 20 mb. after 1-2 hours the app closes with a out of virtual memory message.
I read about how to disposing objects, and the importance of this thing but I need some help about how it works in practise. Or an idea about my main problem: the out of virtual memory message.
 
the out of virtual memory message.
That's a different story.
I read about how to disposing objects, and the importance of this thing but I need some help about how it works in practise
If an object (class instance) has a Dispose method you must use it whenever you are finished using it, simple as that. If you have long lifetime variables it is also a good idea to clear/dereference these when they are not in use instead of just letting them linger carelessly, if you look over your code again you should be able to see if you are keeping things in memory that need not be there at any given time. I had particularly class variables or shared variables/modules in mind, but this may also apply to a single method where you may fill one object after the other and at the end of block end up with lots of garbage. Collections and arrays can be cleared (Clear method), in some cases you may also want to reset the capacity.
embedded xp
I had a look at .Net for XPe download page, but RAM is not listed as requirement there, so this probably follows OS req.
 
Back
Top