HTMLviewer memory not being released

Hi Guys,
its an old one but a good one.
When you load a page in a HTMLviewer and then load another page the memory is never released
each page consumes more memory until the app/computer crashes

Did anyone work out a hack to solve this

Windows

thanks
Damon

Desktop ? Web ?

Hi Michel,

sorry - desktop - windows
thanks

Under Windows you can use the Microsoft Web Viewer Active X. You will find it in Insert/Active X.

It uses a set of events and methods different from the Xojo HTMLViewer.

See https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.aspx

Does this happen with the WebKit renderer on Windows?

HI Guys,

i have done some more digging and I don’t think it is a memory leak.

The Active X does the same as the HTMLviewer

It is a bit of a weird way that the information is cached.

I assume when you call GOBACK it uses this stored information

Problem is that everything is always cached.
The more pages you view the more memory is consumed by the cache.

You cannot use HTMLviewer = nil as there is no way to then “Start” it again

I.e.
HtmlViewer1 = new HtmlViewer
will give an exception.

I have checked and you can tell the browser not to cache the page if you own the page being cached

I don’t suppose anyone knows how to get HTMLviewer to clear the cache?

Hi Tim,
I haven’t tried webkit, do you think it might make a difference given the above?

thanks
damon

You could put one in a container and then embed a new container periodically.

Hi Greg,

sort of tried that however I’m no good at container controls.

can you give me a hint as to how to embed a new container periodically.
I can set it up OK just don’t know what to do next

[quote=273380:@Michel Bujardet]Under Windows you can use the Microsoft Web Viewer Active X. You will find it in Insert/Active X.

It uses a set of events and methods different from the Xojo HTMLViewer.

See https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.aspx[/quote]

Do you mean the Web Browser ActiveX control? Webview is not the same thing.

simple container control example

crate a containercontrol and put a HTMLviewer in it - call the containercontrol “test”

create a property “cont as test”

pushbutton 1 - “Create”
cont = New test
cont.EmbedWithin(self, 10,10,300,300)

pushbutton 2 - “Load”
cont.HTMLViewer1.LoadURL (“www.google.com”)

pushbutton 3 - “Close”
cont.HTMLViewer1.close
cont.Hide
cont=nil

when you run the app Memory = 6452K
create - no real change to the memory
Load - 16428K
Load - 17340K
Load - 17512K
as expected it gets larger the more times you load the page.
Close - memory drops to 12288K

some memory is retained however when you repeat and repeat the memory always ends up at about the same level.

Happy with that

Thanks all
Damon

I have been trying this for a while and I don’t like the way it is going.

I think i will stick with a reboot the app option once the memory gets over a GIG.

Might try a feature request for HTMLviewer.clean to wipe the cached data etc…

Unless someone has another option?

[quote=273407:@damon pillinger]I have been trying this for a while and I don’t like the way it is going.

I think i will stick with a reboot the app option once the memory gets over a GIG.

Might try a feature request for HTMLviewer.clean to wipe the cached data etc…

Unless someone has another option?[/quote]

This forum lacks an “unlike” button. Think this is really a miserable way to solve a problem.

[quote=273407:@damon pillinger]I have been trying this for a while and I don’t like the way it is going.

I think i will stick with a reboot the app option once the memory gets over a GIG.

Might try a feature request for HTMLviewer.clean to wipe the cached data etc…

Unless someone has another option?[/quote]

It is probably not Xojo but the underlying Microsoft control rather.

“This forum lacks an “unlike” button. Think this is really a miserable way to solve a problem.”

i feel exactly the same way about your comment :slight_smile:

Not solving a problem is miserable - ask your clients

Hi Peter,
“It is probably not Xojo but the underlying Microsoft control rather.”

really?
If you chEck you will find the sAme for Macinshit.

ps - so yOu can impove your english ““It is probably not Xojo rather the underlying Microsoft control .””

I agree, for the time being. But you should keep an eye on it and provide a better fix as soon as it is available.

[quote=273451:@damon pillinger]Hi Peter,
“It is probably not Xojo but the underlying Microsoft control rather.”

really?
If you chEck you will find the sAme for Macinshit.

ps - so yOu can impove your english ““It is probably not Xojo rather the underlying Microsoft control .””[/quote]

No need to teach me English, pumpkin - go write code rather.

EDIT:

https://social.msdn.microsoft.com/Forums/ie/en-US/88c21427-e765-46e8-833d-6021ef79e0c8/memory-leak-in-ie-webbrowser-control?forum=ieextensiondevelopment

Keep it civil & within the posting guidelines

fair enough

The answer seems to depend heavily on which IE engine you are using. Are you setting the registry so that you get IE11? or are you defaulting to IE9 (or IE7).