disposed instances

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
stijn
Posts: 23
Joined: Thu Jun 28, 2007 2:57 pm

disposed instances

Post by stijn » Tue Sep 18, 2007 1:47 pm

Hi,

I have following line in my snapshot :
Namespace Name Live instances New live instances Removed live instances Delta live instances Live bytes Max live instance size Min live instance size Delta live bytes Allocs/sec Bytes/sec
Unchecked DIASUI.Admin vwContactTypes 1 0 0 0 472 472 472 0 0,00 0,0

So i think there is 1 live instance of this form in memory ?
The form is closed, and disposed, so if it is still alive then i have a leak

When i look at the details , The disposed column is checked, (the white paper with the red cross)
Disposed Instance Referenced by (count) Size Age
Unchecked Checked #55908 19 472 15


The form also has another strange rootpath :
RemotingServices.AllocateUninitializedObject(Type)
ActivationServices.CreateInstance(Type)
ProxyAttribute.CreateInstanceInternal(Type)
ActivationServices.IsCurrentContextOK(Type, object[], bool)
RuntimeType.CreateInstanceSlow(bool, bool)
RuntimeType.CreateInstanceImpl(bool, bool, bool)
RuntimeType.CreateInstanceImpl(bool)
Activator.CreateInstance(Type, bool)
Activator.CreateInstance(Type)
frmMain.ShowView(string) (this is my main form, which is still alive)
frmMain.contactTypesToolStripMenuItem_Click(object, EventArgs)
ToolStripItem.RaiseEvent(object, EventArgs)
ToolStripItem.OnClick(EventArgs)
ToolStripMenuItem.OnClick(EventArgs)
ToolStripItem.HandleClick(EventArgs)
ToolStripItem.HandleMouseUp(MouseEventArgs)
ToolStripItem.FireEventInteractive(EventArgs, ToolStripItemEventType)
ToolStripItem.FireEvent(EventArgs, ToolStripItemEventType)
ToolStrip.OnMouseUp(MouseEventArgs)
ToolStripDropDown.OnMouseUp(MouseEventArgs)
Control.WmMouseUp(Message&, MouseButtons, int)
Control.WndProc(Message&)
ScrollableControl.WndProc(Message&)
ToolStrip.WndProc(Message&)
ToolStripDropDown.WndProc(Message&)
Control.ControlNativeWindow.OnMessage(Message&)
Control.ControlNativeWindow.WndProc(Message&)
NativeWindow.Callback(IntPtr, int, IntPtr, IntPtr)
[Unmanaged to managed transition]
[Managed to unmanaged transition]
UnsafeNativeMethods.DispatchMessageW(NativeMethods.MSG&)
Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int, int, int)
Application.ThreadContext.RunMessageLoopInner(int, ApplicationContext)
Application.ThreadContext.RunMessageLoop(int, ApplicationContext)
Application.Run(ApplicationContext)
AppContext.Main()


Thanx for any clarity on this situation

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Tue Sep 18, 2007 6:54 pm

Hi,

If the form still exists in memory after you have closed and disposed it (and it is presented as disposed in the profiler), then it seems like there is a memory leak.

In order to find out what's causing the leak, you need to investigate the root paths of the form. You included the allocation call stack in your message, not a root path. The root paths are presented above the allocation call stack in the instance details view.

If you provide me with a root path of the form instance, I might be able to explain why your form is not properly GCed.
Best regards,

Andreas Suurkuusk
SciTech Software AB

stijn
Posts: 23
Joined: Thu Jun 28, 2007 2:57 pm

Post by stijn » Thu Sep 20, 2007 9:39 am

Hi,

the rootpath told me the same story about the visible toolstrip dispose bug again, apparantly this toolstrip slipped thru my previous fix attempt ...


so problem solved
thx

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 26 guests