Avatar of tharstern
tharstern
Flag 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?
Crystal ReportsC#

Avatar of undefined
Last Comment
tharstern

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
AndyAinscow

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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.
vasto

Try to add
GC.WaitForPendingFinalizers()
after GC.Collect() to see if this will change something
tharstern

ASKER
I added in the GC.WaitForPendingFinalizers() but unfortunately there is no difference.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
tharstern

ASKER
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.