Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reproducible error when loading many reports (Load report failed -> Not enough memory for operation)


Win 7 SP 1

Visual Studio Pro 2012 Update 4

Crystal Reports for Visual Studios Service Pack 10 (

Report created in Crystal Reports XI Release 2 (

Targeting x86 .NET 4.0


We have a program that runs and creates a large number of reports before the process is ended. When running after many hours we'd get a Load report failed/Not enough memory of operation exception. I kept removing code and found i could reproduce just using the report.Load call. I simplified the report to a completely blank report to make sure it was nothing specific to a report I was loading. (Opened Crystal Reports XI Release 2, Save As, "Blank.rpt".). I then created, loaded, and disposed of this report in a loop. I was able to cause the same exception after 32,764 iterations on my machine. I also tried using .NET 3.5 same result. I added a counter to our main program and it also went through 32,764 report loads before the same exception was thrown. Main program uses 15 or so different reports with a variable number of subreports in each.

Sample Code to illustrate the problem:

I did this as a WinForms project since our main program is using winforms.

References added:





using System;

using System.Windows.Forms;

using CrystalDecisions.CrystalReports.Engine;

namespace CrystalTest


    public partial class Form1 : Form


        public Form1()



            int i = 0;



                while (true)



                    ReportDocument report = new ReportDocument();






            catch(Exception ex)


                MessageBox.Show(i.ToString() + ex.Message);






CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80041004):

Not enough memory for operation.

   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)

   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)

   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

   --- End of inner exception stack trace ---

   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)

   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)

   at CrystalTest.Form1..ctor() in c:\Test Projects\CrystalTest\CrystalTest\Form1.cs:line 27

Former Member
Not what you were looking for? View more on this topic or Ask a question