cancel
Showing results for 
Search instead for 
Did you mean: 

Disposing resources used by crystal reports

Former Member
0 Kudos

My company is using crystal reports 10.2 (embedded in VS 2005). Some of reports print images. What we do we convert the images to bytes and then put it in a datatable. Then we pass that datatable to the crystal reports to display the images.

The images displayed are fine., but the problem is it allocates a huge chunks in the memory. To explain further, we loaded five images, when we navigate through in the crystal reports viewer to check the images it add 1mb in the memory. upon loading it adds 1mb in the memory and then when navigating to the next images it adds 1mb again and so on... well it seems understandable because we are loading huge images, but then what we expected is if close the form the used memory should decrease.

In the closes form event of the our form we put this lines of codes:

crystalreportsviewer.dispose();

datatable.dispose();

reportdocument.dispose();

GC.Collect();

But still the memory consumed doesn't diminished

Can you suggest us how to overcome this dilemma?

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

You don't metion if you have SP 1:

https://smpdl.sap-ag.de/~sapidp/012002523100006007872008E/crvs05sp1.exe

Also, add .close to your code:

crystalreportsviewer.dispose();

datatable.dispose();

reportdocument.close();

reportdocument.dispose();

GC.Collect();

I suspect adding .close will not make any difference, but see if it helps. Normally all that is needed is .close and .dispose on the reportdocument object.

Also, when you say; "the memory consumed doesn't diminished", what are you monitoring. Private bytes? Handles? Etc.? What tool are you using to monitor the memory? Is the memory returned on app close? If this is a win app, do you see the same issue running the app as an exe?

Ludek

Edited by: Ludek Uher on Feb 11, 2010 6:51 AM

Former Member
0 Kudos

>

> You don't metion if you have SP 1:

> https://smpdl.sap-ag.de/~sapidp/012002523100006007872008E/crvs05sp1.exe

>

> Also, add .close to your code:

>

> crystalreportsviewer.dispose();

> datatable.dispose();

> reportdocument.close();

> reportdocument.dispose();

> GC.Collect();

>

> I suspect adding .close will not make any difference, but see if it helps. Normally all that is needed is .close and .dispose on the reportdocument object.

>

> Also, when you say; "the memory consumed doesn't diminished", what are you monitoring. Private bytes? Handles? Etc.? What tool are you using to monitor the memory? Is the memory returned on app close? If this is a win app, do you see the same issue running the app as an exe?

>

> Ludek

>

> Edited by: Ludek Uher on Feb 11, 2010 6:51 AM

thanks to your prompt reply.

even if disposing and closing the reportdocument object doesn't release the consumed memories.

This is an win app, actually i'm monitoring the memory in the task manager performance tab. When I close the application the memory is returning to it's original value.

I'll try the patch...

0 Kudos

Crystal will not release all of its consumed memory after a report is released. When your app starts up Cr loads it's dependencies and they stay in memory until the app is closed. All you can do is release the memory for the report objects, core components will stay in memory.

This is how Windows OS works, no way around it.

Thank you

Don

Former Member
0 Kudos

>

> Crystal will not release all of its consumed memory after a report is released. When your app starts up Cr loads it's dependencies and they stay in memory until the app is closed. All you can do is release the memory for the report objects, core components will stay in memory.

>

> This is how Windows OS works, no way around it.

>

> Thank you

> Don

Thank you again for your prompt reply... Now i have a very good explanation to my boss...

Answers (0)