StrataFrame Forum

Task Manager - Memory Usage

http://forum.strataframe.net/Topic8683.aspx

By Tim Dol - 5/4/2007

I noticed something with memory usage with .NET applications that I didn't see with VB6 Apps, and was wondering if I'm doing something wrong or if this is normal behavior.

I created a small test SF Maintenance form with a browse dialog.  I invoke the browse and perform a search...memory jumps up a little.  I close the dialog and memory does not go back down.  I then invoke the browse again.. and again... memory keeps increasing.

Is this normal?  I made sure I disposed of all objects.

Thanks
Tim

By StrataFrame Team - 5/4/2007

Yes, with .NET this is normal... the memory does not go back down until the Garbage Collector decides to run a collection, and generally, a collection isn't run until the application gets to the point where it's reaching it's defined heap limit (which is bigger the more RAM you have in the machine...).  So, even when you dispose of something, the actual memory is not reclaimed until the garbage collector runs.  You can run a collection manually by calling GC.Collect(), but I would recommend against it because it can slow down you application considerably letting .NET run it on its own works for about 99.999% of the time Smile

Generally, if you watch it long enough, you'll notice a big drop in the amount of memory... and you know a collection was just run.

By Chan - 5/4/2007

Hi,

I heard that is utility in Java to do garbage collection manually to clean up memory. Is there any in .NET? I need it to clean up memory during design time.

Thank you

By Trent L. Taylor - 5/5/2007

Yes, though it is not recommended, but you can force the garabage collection by calling GC.Collect().