?
Solved

InitializeComponent memory leak I think

Posted on 2005-03-13
3
Medium Priority
?
380 Views
Last Modified: 2006-11-17
I have a form I request as follows:

dim oform as new frmDASHBOARD
oform.show()

When I close the oform I assume all my managed and unmanaged resources are released.   Well they seem to be relasing, but the initializationcomponents seem not to be releasing.  I have several demo software tools for memory analysis and all indicate that the initializatoncomponent module isn't releasing the objects.

What could I be doing wrong?

I'm at my wits end....

Everytime I start a new oform my memory increases by about 1.2 meg each time.....  never ever releases.....

HELP ................................

0
Comment
Question by:fchav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:S-Twilley
ID: 13532066
have you read through the help file on Garbage collection (and the GC object) ?

There's also a helpful page called "Initialization and Termination of Components"... which appears in the help file under the category "garbage collection"... and sub category "component authoring and"

0
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 750 total points
ID: 13532566
>> When I close the oform I assume all my managed and unmanaged resources are released.

No they are not.
The memory taken by your oForm will be relaesed only when the Garbage Collector(GC) Runs. And the GC runs when it feels like it.
So if you open a form say (1mb of memory is used) then you close it (still 1 mb used) then open it again ( another 1 mb so now 2 mb used) and s on.

Now when the memory gets filled (almost) our GC will decide its time to clean up, then it will run and clean up the memory.

In case you want that as soon as you close your oForm the memory should be reclaiemd call "GC.Collect" explicilty, However this is not advisable, as the collection process is very resource intensive.
0
 
LVL 4

Expert Comment

by:wyoung76
ID: 13532945
Also, personally I think that it's important to remember that .NET will use as much _free memory_ (not being used by anything else, and won't be impacting performance in a noticeable way) as there is currently available to it.  So if you always have, say, 500 megs of memory free all the time before running your app, then given enough time .NET will fill up a good porportion of that free memory.

As soon anything else in the system needs more memory, then it will be released in the way that arif_egbal has noted.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question