PDA

View Full Version : dotNet memory leak


PEN
11-25-2010, 05:42 PM
try(controlPanelList.dispose())catch()
controlPanelList=dotNetObject "listView"


Should that not clean it self up? If you run it over and over the memory climbs slowly.

Gravey
11-26-2010, 01:54 AM
as far as i'm aware, dispose only cleans up any unmanged resources associated with the object/control. the rest of the object wont be cleaned up until the next garbage collection.

Is the memory freed after you run a System.GC.Collect() ?

PEN
11-26-2010, 12:16 PM
I should have mentioned that I tried that as well. I don't remember seeing issues like this and I have created huge dotNet tools.

Gravey
11-26-2010, 02:57 PM
how often are you creating and disposing listviews that its becoming a problem?

PEN
11-27-2010, 02:46 PM
Well I'm not, but reopen the tool and mem goes up, over a day I don't know how often some one will open the UI.

Pjanssen
12-01-2010, 11:41 AM
What happens if you run maxscript's garbage collection after the .NET dispose?
try(controlPanelList.dispose())catch()
gc light:true

I've had similar experiences with apparent memory leaks when using .NET objects, and if I remember correctly, it was gone when using maxscript's gc...

PEN
12-01-2010, 11:48 AM
I didn't even think to try. I'll give it a shot and see what happens.

Pjanssen
12-01-2010, 12:55 PM
I've been looking at some of my 'old' code, and I usually do it in this order:

Dispose the object through its Dispose() method
Nullify the object (theVar = undefined)
System.GC.Collect()
gc light:true

Now I know that I've been messing about with this issue too, but I can't remember the exact outcome or reasons for it. So I think this was either the actual solution to it, or a sort of "it can't hurt to do it" type of action... hehe.

CGTalk Moderation
12-01-2010, 12:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.