Welcome Guest Search | Active Topics | Sign In | Register

Constant memory increase Options
Grape Solutions
Posted: Friday, July 27, 2018 4:50:14 AM
Rank: Newbie
Groups: Member

Joined: 7/27/2018
Posts: 2
Hello!

I post here a short code how we use EO:

Quote:
MVCToPDF.ResultFileName = request.ID;
HtmlToPdf.Options.UsePrintMedia = true;
MVCToPDF.RenderAsPDF();
return View("../BoardingCard/Html", modelList);


The memory consumption is shown below. We created 10000 PDFs, the y axis is the memory consumption.



As you can see there is a constant rise in memory consumption.

How could we eliminate this problem?

Thank you!
eo_support
Posted: Saturday, July 28, 2018 12:47:22 PM
Rank: Administration
Groups: Administration

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

We are not able to see your picture. The most likely reason for the memory increase is the conversion result that is stored in HtmlToPdf.Result property. This property is thread static thus it is not being automatically garbage collected. For low volume conversion this is usually not a problem due to the number of threads involved as well as the default recycling behavior of an ASP.NET web application. However this can be a problem for high volume site like yours.

To avoid this problem, you can pass afterConversionHandler callback when you call RenderAsPDF. See here for more details on how to use this argument:

https://www.essentialobjects.com/doc/eo.pdf.mvc.mvctopdf.renderaspdf_overload_1.aspx

Inside your handler you can call HtmlToPdf.ClearResult to clear HtmlToPdf.Result property.

Please let us know if that resolves the issue for you.

Thanks!
Grape Solutions
Posted: Monday, August 6, 2018 4:33:27 AM
Rank: Newbie
Groups: Member

Joined: 7/27/2018
Posts: 2
We fixed the image.

We try your suggest, thank you!
Inform you soon the result.
eo_support
Posted: Monday, August 6, 2018 4:17:15 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Thanks for the update. You can also download the latest build (18.2.53) from our download page. This build will automatically clear HtmlToPdf.Result for you after a short period of time.


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.