Link to home
Start Free TrialLog in
Avatar of onebadboy
onebadboy

asked on

Webbrowser Control Memory

I have an application that has a webbrowser control on it. I'm getting information from a server, writing an html file and then having the webbrowser control display it.

I noticed via Windows Task Manager that whenever I display a new page in that control (I'm using WebBrowser.Navigate) The memory just keeps going up and up. Even if I just display the same exact page. Is there anyway to clear or release the memory that this control is using.

ASKER CERTIFIED SOLUTION
Avatar of DragonSlayer
DragonSlayer
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
listenning...
me too :(
Avatar of onebadboy
onebadboy

ASKER

What that ??? That appears to work great. It took the Mem Usage from 13MB down around 5 - 7. Where can I get some documentation on that function
Cesario,

I packaged into an installshield file and installed it on a couple of machines. Everytime the application runs it gives me a Acess Denied 0000000 at address 000000 method (or something like it). Based off of the link that you sent me I think it has something to do with that. I'm not really big on delphi development Can you help me out here I'll give you 200 points if you'll show me what to do to get rid of that Access Denied error and still have a small memory foot print.
hmm... and you are sure it is caused by SetProcessWorkingSetSize? I have been using it for some time... no errors yet though.
I'm just about positive. I've commented out the code and the errors stopped.
umm... perhaps you still have other things that are processing (in your app) while calling SetProcessWorkingSetSize? because what the call does is to swap everything out from physical RAM; so I suppose if you have other things that are using the memory, there might be some error?

so perhaps you can try calling SetProcessWorkingSetSize before starting any processes?
Where is the best place to put that?

I have the application main form and a thread that runs.
perhaps before the thread executes, and after the thread terminates?
Avatar of Wayne Barron
Thank yyou DragonSlayer :-)

  Putting this code in several differnet places makes the Memory release, and the project
Do not use but about 965kb instead of the 15,000kb that it was.

I set it in 4 different places on the WebBrowser

OnDocumentComplete
OnDownloadBegin
OnNavigateComplete2
OnProgressChange

In the MainForm I have it in:

TabSheet1.Show   // Using a Frames on TabSheet project.

Before the Memory was about 15,000kb
Now with these settings (Hope it is not an overkill and cause problems)
But it has made it to where.

While Navigating....  4,345kb
After Navigating ....  768kb - 965kb

Great Job. And thanks a LOT :-)

Carrzkiss