Welcome Guest Search | Active Topics | Sign In | Register

EO.Pdf Consuming IIS Memory and Not Releasing it Options
Alex
Posted: Tuesday, March 11, 2014 6:02:28 PM
Rank: Newbie
Groups: Member

Joined: 1/29/2013
Posts: 9
Hi,

We are using the MVCtoPDF in MVC4 Application to render a view. We have decorated our Controller with [AutoConvert=false] and are calling MVCToPDF.RenderAsPDF() method. Before calling RenderAsPDF we are setting two HtmlToPdf options as below

HtmlToPdf.Options.PageSize = new SizeF(PdfDocumentSize, PdfConfig.PageHeight);
HtmlToPdf.Options.OutputArea = new RectangleF(0.25f, 0.25f, PdfDocumentSize - 0.5f, 10.5f)

It runs fine and generates the PDF file. However, it seems to hike up the memory consumption in our server. It doesn't seem to release memory. Can you please suggest what is the resolution for this. Code snippet as belows.

[HttpPost]
[RenderAsPDF(AutoConvert = false)]
public ActionResult ExportToPDF(FormCollection form)
{

......

HtmlToPdf.Options.PageSize = new SizeF(PdfDocumentSize, PdfConfig.PageHeight);
HtmlToPdf.Options.OutputArea = new RectangleF(0.25f, 0.25f, PdfDocumentSize - 0.5f, 10.5f)

.....

MVCToPDF.ResultFileName = FileNameFormats.GetFormattedFileName("ExportPDF", "pdf");
MVCToPDF.RenderAsPDF();

//pdfHtml is a viewmodel which will have html strings
return View("_ExportPdf", pdfHtml);


}

Please let us know if there is a known issue regarding this. The PDF generated can sometimes be around 3-4 MB or larger.
eo_support
Posted: Tuesday, March 11, 2014 9:25:27 PM
Rank: Administration
Groups: Administration

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

We are not aware of any memory issue with MVCToPDF. The memory usage may not corresponds to the actual conversion. For example, when the first conversion is called our library will initialize its internal "conversion engines" and that will take up memory. That memory will not be released unless your application has been sitting idle for a long time (similar to what IIS does). So you may not see memory drop significantly immediately after the conversion. However if you continuously perform conversions, you should see memory usage fluctuate instead of keep going up without coming down.

Thanks!
Alex
Posted: Friday, March 14, 2014 3:21:48 PM
Rank: Newbie
Groups: Member

Joined: 1/29/2013
Posts: 9
Thank you for your reply. In our tests to generate 2.5MB of PDF file, we have noticed that both w3wp.exe and rundll32.exe takes up a significant amount of memory, IIS worker process consumes more than a GB of memory. We run the same code to generate a CSV file and memory consumption is significantly less than that. Is this a normal behavior? Can we do something to prevent such a memory hike. Please let us know.
eo_support
Posted: Sunday, March 16, 2014 5:27:35 PM
Rank: Administration
Groups: Administration

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

Because .NET uses garbage collector, so it is hard to say whether it is normal just by looking at your process's memory consumption. If the memory consumption keeps climbing and never comes down, then obviously it's a problem. However your system has a lot of free memory then it can be normal that the process uses more because it sees more available. If your system does not have a lot of memory (for example your system only has 4G and w3wp.exe uses 1G), then it may be an issue.

You can try to use the Url to PDF demo in our demo application to convert the same page and see if you see similar memory spike. If you do, you can try to isolate the page into a self contained zip file (with all the HTML, images, JavaScript, etc) and send that to us. We will try to run it here and see if we can find out what triggers the memory usage. We will PM you as to where to send the test file.

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.