Skip to Content

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

Crystal Report 2013 memory problem

Hi,

I am developing a Windows service. The service calls Crystal Report to generate PDFs. When a new contract appears in database (MS Access), the service reads contract number and build a formular. Then pass the formular to ReportDocument. The code looks like this

using (ReportDocument report = new ReportDocument()) {

  report.Load("contract.rpt");

  // some initialize report

  foreach (var contract in contracts) {

    report.RecordSelectionFormula = BuildFormular(contract);

    report.ExportToDisk(ExportFormatType.PortableDocFormat, BuildOutputFilename(contract));

  }

  report.Close();

}

It works fine. When deploy on production, I want the location of Access file can be changed programmatically. So I modified the code

using (ReportDocument report = new ReportDocument()) {

  report.Load("contract.rpt");

  // some initialize report

  foreach (ReportDocument subreport in report.Subreports) {

     foreach (Table table in subreport.Database.Tables) {

       table.Location = MdbPath;

    }

  }

  foreach (Table table in report.Database.Tables) {

    table.Location = MdbPath;

  }

  foreach (var contract in contracts) {

    report.RecordSelectionFormula = BuildFormular(contract);

    report.VerifyDatabase();

    report.ExportToDisk(ExportFormatType.PortableDocFormat, BuildOutputFilename(contract));

  }

  report.Close();

}

It works but memory increases over time. Here are Private Bytes (I use Performance Monitor tool)

  • 10:45 - 58.000MB
  • 11:00 - 61.801MB
  • 11:15 - 64.611MB
  • 11:30 - 65.544MB
  • 11:45 - 65.716MB
  • 12:30 - 69.095MB

I also attached some screenshot of report of DebugDiag tool.

My environment:

  • Net framework 4.5
  • Tool runs as Windows Service
  • Crystal Report 2013 (Crystal Report Runtime 32bit 13.0.10.1385).
  • Database: MS Access/OleDb

Any suggestion?

Many thanks

summary.PNG (67267 B)
Finalizer.PNG (43493 B)
Former Member
Not what you were looking for? View more on this topic or Ask a question