Link to home
Start Free TrialLog in
Avatar of tharstern
tharsternFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to release memory when the parameter dialog appears in Crystal Reports 2008

We are using Crystal Reports 2008 SP5 in VS2008.

One of our users found that after running a lot of reports (50+) that the memory of our application had increased considerably.

To track the issue I created a simple app that displays a report from a path.  There is no database connection in the report.

Running the report once loads all the dll's into memory.
If the report doesn't include a parameter then after running the report a second time the memory returns to what is was.

Change the report to now include a parameter and running the app again.
The parameter select dialog will now appear each time the report is run.
Running the report once loads all the dll's into memory.
After running the report a second time all the memory isn't released. It increased by about 2,000KB

If we keep running the report that displays the parameter dialog the memory keeps increasing and is never released.

We use the ReportDocument.Close() and ReportDocument.Dispose() and GC.Collect(), which does release the memory if there are no parameters.

I also tried running the report directly within Crystal Reports 2008 with the same results.

Is there something else needed to be done to dispose of the memory when parameters are displayed?
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tharstern

ASKER

I've checked their website and can't find any fixes related to this.  I think SP5 is the latest version of CR2008.  Closing the application would fix the memory problem but it's not very practical for our application.

Writing our own interface would solve this but I was hoping to carry on using the standard prompt.

We're using the CrystalViewer on a form.  We set the CrystalViewer.ReportSource = ReportDocument of the loaded report. The form is closed after each report and we set CrystalViewer.Dispose and CrystalViewer = null when the form is closed.
Try to add
GC.WaitForPendingFinalizers()
after GC.Collect() to see if this will change something
I added in the GC.WaitForPendingFinalizers() but unfortunately there is no difference.
I can create the issue within Crystal Reports 2008 SP5.
Create a report with no database connection and 1 parameter.  Keep refreshing the report and choose "Prompt for new Parameter Values" and the memory keeps increasing and is never released until I close the application.
 
Does this happen with anybody else?

Using PerfMon and monitoring the Private Bytes.
In Crystal Reports 2008 SP5, after opening the report the Private Bytes were 41,000,000.  After refreshing the report 10 times it went up to 65,000,000.  After 10 minutes waiting they were still at 65,000,000
 
I tried the same thing in Crystal Reports XI Release 2 and the memory doesn't increase after refreshing, it stays at around 41,000,000.
 
Does anybody know if the same thing happens in Crystal Reports 2011?  If not then we may have to upgrade.