System.OutOfMemoryException

Stimulsoft Reports.NET discussion
Post Reply
OC-Thorsten
Posts: 31
Joined: Thu Jul 16, 2015 12:22 pm

System.OutOfMemoryException

Post by OC-Thorsten »

Hello,

sometimes we get an OutOfMemoryException, if we print a report, open in the preview, or export as PDF.
The error only occurs if the report contains a large image (A4 watermark in overlay band).
But only in one of 50 calls.

The computer's memory is not full and the application is around 200 MB.

Does anyone have a good idea?
I tested the follow options:
- Smoothing on / off
- Report Cache Mode on / off / auto
- Insert Image in report and insert image URL in report

Here the detail exception:
System.OutOfMemoryException: Nicht genügend Arbeitsspeicher.
bei System.Drawing.Graphics.CheckErrorStatus(Int32 status)
bei System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)
bei System.Drawing.Bitmap..ctor(Image original, Int32 width, Int32 height)
bei System.Drawing.Bitmap..ctor(Image original)
bei Stimulsoft.Report.StiFileImageCache.LoadImage(String path)
bei Stimulsoft.Report.Components.StiView.get_ImageToDraw()
bei Stimulsoft.Report.Painters.StiImageGdiPainter.Paint(StiComponent component, StiPaintEventArgs e)
bei Stimulsoft.Report.Components.StiComponent.Paint(StiPaintEventArgs e)
bei Stimulsoft.Report.Painters.StiContainerGdiPainter.PaintComponents(StiContainer container, StiPaintEventArgs e)
bei Stimulsoft.Report.Painters.StiPageGdiPainter.Paint(StiComponent comp, StiPaintEventArgs e)
bei Stimulsoft.Report.Components.StiComponent.Paint(StiPaintEventArgs e)
bei Stimulsoft.Report.Components.StiPage.Paint(Graphics g)
bei Stimulsoft.Report.Viewer.StiThumbsControl.OnPaint(PaintEventArgs e)
bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
bei System.Windows.Forms.Control.WmPaint(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: System.OutOfMemoryException

Post by HighAley »

Hello.

If there are large images, you could get such error because of the fragmentation of the memory.
It's necessary to get the one large block of the memory for a large image. If there is no such block you could get such error.
Even of the free memory is available.

In 64 bit application you should not get such exception or it will be much more rarely.

Thank you.
OC-Thorsten
Posts: 31
Joined: Thu Jul 16, 2015 12:22 pm

Re: System.OutOfMemoryException

Post by OC-Thorsten »

We can not be up to 64 bit.
The watermark is a png (115 kb).
Are there any other workarounds? Perhaps by changing the file format?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: System.OutOfMemoryException

Post by HighAley »

Hello.

At rendering time the image is stored in memory unpacked as bitmap.
So it could take very much memory and changing of the file format will not solve the issue.

Thank you.
rksaskia
Posts: 58
Joined: Fri Apr 27, 2012 9:16 am

Re: System.OutOfMemoryException

Post by rksaskia »

Hello Stimulsoft,

or you implements support for vector graphics, your image control can load wmf/emf files, but if you export to pfd, you render as bmp, that the reason for memory consumtion.

Greetings
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: System.OutOfMemoryException

Post by Ivan »

Hello,

Can you please send us a sample report template with data, which reproduces the issue, for analysis?

Thank you.
Post Reply