Memory leak, windows form containing an activex component.

Hello All,

We have developed a windoes application, in one of the forms we are using an activeX control xpdfviewer (http://www.glyphandcog.com/XpdfViewer.html).

I was looking at memory usage using the scitech memory profiler(http://memprofiler.com/), i found that even after the form containing that activeX control is closed, a live instance of the form is showing, but when i try to get the details of it, it says this instance has been disposed. I think its a potential memory leak issue.

Can any one please suggest, how to overcome this issue, may be using finalizers to clean up the unmanage code properly. Any pointers will be helpful.

Thanks,
Vinay Kant



Answer this question

Memory leak, windows form containing an activex component.

  • guy kolbis

    Hi,

    Is your problem solved yet

    Thank you,
    Bhanu.



  • Cristian Civera

    Actually not, other forms when closed doesn't show as live instances in the memory profiler after the heap snapshot. Also, forgot to mention we are using VB .NET.

    Any other pointers.

  • maglor_elf

    Windows forms does not destroy your form when you close it, it just hides it. I'd say that's what you're seeing.



  • R102oy

    As you said earlier the form is returning as disposed. Which is what you will expect from .NET. It doesn't actively clear the memory. The garbage collector (GC) will do it in an interval. You can call GC.Collect if you want but it's not necessary as long as you dispose objects properly. Setting the object to "null" or "Nothing" after disposing it will flag that object for immediate collection, but not instant collection.
  • Memory leak, windows form containing an activex component.