memory leak? serious one! need help pls.

thejeraldo

Well-known member
Joined
Jun 9, 2009
Messages
70
Location
Philippines
Programming Experience
1-3
guys i need serious help/advice here.. im not yet done with my proj but i made a setup proj for it to test and see its memory consumption. for now it only has two forms that has an oledbconnection, uses datasets and dataadapters.. it consumes 44,000+K. when i switch to another form it adds up more than 10,000K. i use task manager to look at the memory usage. when i minimize it. it only consumes 1000K (which i think is natural to any program that it reduces mem consumption when minimized). when i maximize it again it consumes 20,000+K then if i switch from form to form it still increases a lot. it hasnt crashed but i think it will if i continue switching.

i even use dispose for my connection and closed it too but still the same.

please help...:(
 
i was kinda wondering... is it because i use VS2008 and my framework for the proj is 2.0? should using 3.5 framework work instead? if this could help or solve the mem leak then how do i change the framework of my project to another?
 
The values you see when form is maximized has no sensible meaning, the 1000K you see when minimized (XP) is more likely close to apps current real mem usage, but this number may also be too high actually. You should know that .Net does memory management dynamically, and also has allocations common to all .Net apps that may be running.
 
.Net runtime has good memory management and a garbage collector that will eventually take care of loose ends, but you should still know what you're doing in code, and if not, learn it ;)
Memory usage is for stuff that need to be there, for example a form with controls and the data it displays, for data caching to avoid more Cpu usage, and for temporary data processing.
 
well i kinda tried a memory profiler for my app and saw that my controls were not being disposed or was still in my resources even if the form was closed. is this normal?
 
If you show a form modally with ShowDialog then it is not disposed when the dialog returns, because caller at this point normally interacts with it, you have to call Close or Dispose when done with it.
If the form was shown modeless with Show method then the form is disposed when it is closed, either by user or by a call to Close method (or Dispose).
When a form is disposed it will also dispose all child controls.

I'm not familiar with the memory profiler, never found the need to use one yet.
 
Back
Top