Could not see memory being released on closing MFC modal dialog that hosts wpf user control using HW

Posted by Naveen Chiluka on Stack Overflow See other posts from Stack Overflow or by Naveen Chiluka
Published on 2010-06-09T14:59:17Z Indexed on 2010/06/09 15:02 UTC
Read the original article Hit count: 248

Filed under:

This is in continuation with my last question posted "Continuous Memory leak while using WpfHWndSource"

I have to load an WPF User Control in an MFC Modal Dialog that is being invoked from the ocx control. For this I have created a MFC Regular Dll(Mixed Mode Regular dll with clr option enabled), I have created a modal dialog which will host wpf user control using HWndSource. This exported dialog is placed as a child Dialog of the above MFC dialog that is being invoked from the ocx. Ny intermediate dialog uses C++/Cli code.

When the main MFC dialog is closed, I am deleteing the ptr reference of the intermediate dialog created on the heap.

In the the dipose of the .Net User Control, I have set most of the references that I have created to null, unsubscribed to the events (to avoid weak refernces), unbinded from the propertes(by using clear binding).

Called delete on the HwndSource and the user control(which basically calls the dispose method). But I do not see complete memory being released.

Any help would be greatful.

© Stack Overflow or respective owner

Related posts about wpf