I am writing a generic ActiveX control container, in MFC VC6 to hold the controls designed through VB6.
Here I am dynamically creating the controls at RunTime through CWnd::CreateControl() function. At this stage memory and gdi objects of the container is increasing. It is ok due to the resources in activex are created by now.
Even though I call DestroyWindow and deleting the Control window pointer on Close of the Container page, The Memory allotted and GDI Objects in Task manager are not reducing.
So Frequent opening of saved MDI pages containing ActiveX controls is causing a huge memory leak.
The controls are simple and with bitmaps and shapes.
If I use object = Nothing for the bitmaps and shapes (OnTerminate) the GDI and memory usage reduces by 30 percent.
Where could be the actual problem.. in container or control side? Any more cleanup activity is to be done in activex controls?