0

I have implemented an MFC application with n dynamic DockablePanes which host the web browser control in it.

Everything works fine, there is no memory leak problem until I use these two websites:

With these websites, my application started consuming memory. With both together it takes 2 MB/Second.

When I open only one of these two websites then there is no such problem.

Also, I already tried:

IntPtr pHandle = GetCurrentProcess();            
SetProcessWorkingSetSize(pHandle, -1, -1);

but it didn't help, it only reduced the physical memory while virtual memory continue to climb. At some point the application will crash.

Can you please provide any solution if possible?

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • The `SetProcessWorkingSetSize` idea is a cop-out solution anyway, not a real solution for your problem. And even at that, its a bad one... because likely to cause problems under these circumstances based on how you were using it. – ImmortaleVBR Jun 29 '18 at 13:28
  • The problem is if the webpage creates memory leaks, then those memory leaks will be passed onto the process hosting the web browser control. In a normal web browser, processes get killed and spun up again and again by an orchestrator/manager process, so we don't really notice if a webpage leaks. But since you are not doing that here in your application, the problem can become painfully obvious. – Alexander Ryan Baggett Jun 29 '18 at 14:20
  • Then what should I do? You know I tried webBrowser.Stop() after every 5 second then this memory leak stopped. Is there any real solution? – Ayush Chaudhary Jun 30 '18 at 14:15
  • In my case, this thing works perfectly, with no further memory leak. I am running a timer with less than 5 seconds of time, which execute this below code. `if (m_Browser.GetReadyState()==4) { m_Browser.Stop(); DeleteUrlCacheEntry(view->m_szHtmlPaneURL); }` @ImmortaleVBR what you think? – Ayush Chaudhary Jul 04 '18 at 15:01

0 Answers0