Click to See Complete Forum and Search --> : VB.NET Memory management question


dfb78
November 18th, 2002, 09:09 AM
I can't seem to find any articles on this, but I may be searching incorrectly too.

I have an application that takes up about 7.5 MB when it is initially launched. There is a button on the form that opens another database driven form (if the user chooses to use it). This form takes the entire app up to about 16MB. When the data form is closed however, the app still takes up 16MB. Is there a way I can "trash" that and bring the app back down to 7.5MB, or do I need to wait (as I have been doing) for the entire app to be closed to regain that?

I am still getting familiarized with .NET, so I apologize if this is TOO remedial a question. ;P Thanks for any help.

Sput
November 18th, 2002, 09:23 AM
You can force the garbage collector to do a "garbage collection" by: System.GC.Collect().

This may help. But if your memory is not being regained until to exit the app, there may be something else wrong. Like maybe you are not "releasing" all memory object references.

dfb78
November 18th, 2002, 10:19 PM
Thanks. Well, I currently don't have ANY memory management code in there...just built the Data Form with the included 'X' as the only way to close it. From what I'm gathering from your response though, it may be better to create a "Close" button and add the garbage collegection function.

I think your ultimate point though, is to 'dispose' of all of my objects...so maybe I'll run a trace through the app to see what is still "active" when the form closes. Thanks!