Welcome Guest Search | Active Topics | Sign In | Register

Memory increasing by 1 giga after HtmlToPdf.ConvertHtml Options
Lior
Posted: Thursday, August 24, 2017 7:30:40 AM
Rank: Newbie
Groups: Member

Joined: 8/24/2017
Posts: 2
Hi,

when i'm trying to convert web page to pdf i'm dealing with something strange.
after calling HtmlToPdf.ConvertHtml, the virtual memory increasing up to 1 giga difference, and it's never going down!
I tried to convert it with all the overrides of the function (stream, file, document),
and i'm flushing and closing all the open streams, nothing work.

how can i control this memory leak or whatever it is?
i'm working local so every click on the convert button increasing the memory so afer a few clicks it's crashing.

Thank you very much!
eo_support
Posted: Thursday, August 24, 2017 7:37:47 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
Hi,

There are two parts that will hold the memory after the conversion. One part is the cached font data. The only way to clear that part is to unload your AppDomain.

Another part is the conversion result. This is kept in a per thread static variable. You can clear the result by calling this method:

https://www.essentialobjects.com/doc/eo.pdf.htmltopdf.clearresult.aspx

However after another conversion by the same thread, the previous result should be cleared. So if the memory keeps going up until crash. Then there likely to be some other problems. In that case you can try to isolate the problem into a test project and send the test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Once we have that we will be happy to take a look.

Thanks!
Lior
Posted: Thursday, August 24, 2017 9:05:40 AM
Rank: Newbie
Groups: Member

Joined: 8/24/2017
Posts: 2
Thank you for your quick response.
I tried to track the memory and i found that the first time increasing by 800-1000 MB,
but from now on every click adding about 20-30 MB to the memory, the more times you click, the smaller add you get.

I can't find the function ClearResult(), maybe my version and my license are old, there is a way to add the function?

It will be hard to build something that demonstrating mywebsite and what 'm trying to convert.

And about the appDomain, what are consequences of unloading it?

Thank you.
eo_support
Posted: Thursday, August 24, 2017 2:32:54 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
Hi,

ClearResult only exists in newer versions.

AppDomain is the .NET equivalent of a process, thus unloading a AppDomain is similar to exit your process. When you unload an AppDomain, everything inside that AppDomain will be gone. If you are not familiar with AppDomain, you can search online and you should be able to find plenty of information about it.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.