views:

188

answers:

3

I have found a problem with the MFC CHtmlView class in an MDI app. Repeatedly opening and closing windows causes a progressive drain on memory. I’ve researched the problem and found the MSDN article about the BSTR problem (http://support.microsoft.com/kb/241750), implemented those fixes, but there is still a large drain occurring. I’ve identified the problem in both VC8 and VC9, have tried to assure that all interfaces are truly being released, but am totally stumped.

The easiest way to see this is to use the MFC AppWizard (vc8 or vc9) to create a standard MDI app, only change the default CView to a CHtmlView. Compile and run the app in debug, and the app will automatically open a new html window to MSDN. Open the TaskManager to follow the memory used by the app. Close the open window. Then each time you reopen and close a new window you’ll see a definite increase in the memory being held by the app. Once the app is closed though it show no leaks.

If anyone has any information, I'd appreciate hearing from you.

Thanks in advance, Steve Johnson

A: 

Did you ever find any more information on this? I'm having the same issue, and it appears to be stemming from navigate2. There is a leak of memory and handles.

White
A: 

No answer... just confirming that I am experiencing this problem too! The memory is allocated in calls to Navigate() or Navigate2(), but more specifically within that routine, it's the call to IWebBrowser2::Navigate() that actually seems to allocate the memory that isn't released.

whatisron
A: 

You can use SetProcessWorkingSetSize(pi.hProcess, (SIZE_T)-1, (SIZE_T)-1)) to minimize process working set. http://msdn.microsoft.com/en-us/library/ms686234(VS.85).aspx http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/88c21427-e765-46e8-833d-6021ef79e0c8

Sela