Out of memory exceptions

Stimulsoft Reports.NET discussion
jplaberge
Posts: 15
Joined: Wed Dec 03, 2014 9:51 pm

Out of memory exceptions

Post by jplaberge »

Hi, we are using a registered version of Stimulsoft Reports.Ultimate 2014.3.

I experience Out of Memory exceptions when exporting my report and red crosses when previewing using StiViewerControl.

I need to display many high quality images in a report, sometimes over 500 pages. My report will have 1 image per page, resized to fit on the page. Before exporting I use the preview control. Then, the user should be allowed to export to multiple formats, often to PDF, Word or PowerPoint.

No matter how many images the report have, there should be no Out of memory errors. I'm sure we don't need to hold all images in memory.

I have created a custom test project to show the problem. To keep things simple, I pass a list of 50 objects with the same file name to display 50 pages of the same images. In real life it would be a different image for each page.

When the form is loaded, i see a big red cross. If you still are able to see it correctly, you can increase the number of pages. Instead of using the preview control, exporting it directly (with the method ExportDocument) will have an Out of memory exception.

I know my image (Macaca_nigra_self-portrait_large.jpg) is big (1.6 MB), but even when reducing the size I will eventually have exceptions. For instance, I tried the smaller image Macaca_nigra_self-portrait.jpg (400KB) with 500 pages which normally display fine on my computer but when I export to Word or PowerPoint from the preview control, I get an out of memory exception.

Could you please kindly help me find a solution ?

Thank you & Best regards
jplaberge
Posts: 15
Joined: Wed Dec 03, 2014 9:51 pm

Re: Out of memory exceptions

Post by jplaberge »

Digging into the source code, I found out there is a property StiOptions.Engine.ImageCache.Enabled that we can set to true so that not all images will be in memory. The problem is, it makes the preview very slow when going from one page to another. It exports fine, however, with no Out of memory exceptions. If I export to Microsoft Word, I can go easily from one page to another in Microsoft Word. It is fast. So why is your preview control slower than Microsoft Word, for the same report ?

Is there something we can use to improve the preview ?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Out of memory exceptions

Post by HighAley »

Hello.

Please, try to use next options:

Code: Select all

report.ReportCacheMode = StiReportCacheMode.On;
StiOptions.Engine.ReportCache.AmountOfProcessedPagesForStartGCCollect = 2; // default - 20
StiOptions.Engine.ReportCache.AmountOfQuickAccessPages = 5; // default - 50
Thank you.
jplaberge
Posts: 15
Joined: Wed Dec 03, 2014 9:51 pm

Re: Out of memory exceptions

Post by jplaberge »

Thank you for your help.

Do you mean we only need to add these 3 lines after stiReport.Load(reportFilename), and I should not use StiOptions.Engine.ImageCache.Enabled = true ?

If so, the preview is fast but the Export to Word from the preview control still fail with a Out of Memory with the sample application I provided (after exporting with a resolution of 100dpi and 75% image quality).

Did you try to run my application ? It is very important for us to be able to rely on your report engine to produce this report to our customers.


Best regards
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Out of memory exceptions

Post by HighAley »

Hello.

Sorry for the delay with answer.
We need some additional time for analysis of the error.
We will let you know about results.

Thank you.
jplaberge
Posts: 15
Joined: Wed Dec 03, 2014 9:51 pm

Re: Out of memory exceptions

Post by jplaberge »

Hi,

Thank you for taking the time to help us find a solution. We are on a tight schedule in order to deliver new features for our customers on February and we need to have our reports working in January. Can we count on Stimulsoft to improve the report engine and solve the ‘Out of memory’ exceptions ?

Thank you

Best Regards
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Out of memory exceptions

Post by HighAley »

Hello.

Sorry, for the delay with answer.
We are working on your problem now.
We will give you full answer a little later.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Out of memory exceptions

Post by HighAley »

Hello.

We have reproduces the issue and have made an improvement.
Please, download our next prerelease build. Your report will be exported right.

Also, please, move Render method before passing the report to the viewer or this cause additional unnecessary usage of memory. Next code is right:

Code: Select all

stiReport.Render();
stiViewerControl1.Report = stiReport;
Thank you.
jplaberge
Posts: 15
Joined: Wed Dec 03, 2014 9:51 pm

Re: Out of memory exceptions

Post by jplaberge »

Hi,

What prerelease build do I need to download that includes the improvement ?

Thank you
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Out of memory exceptions

Post by Andrew »

Hello,

That build will be uploaded on our website on the next week (most probably on Friday).

Thank you.
Post Reply