I\'ve spent the past few days looking into that and I can\'t seem to figure it out.
I have a c#
WinForms
application that uses the R
It's very tricky with Crystal Report to clean up the mess it creates with memory. (No offence to SAP)
You will have to first close and dispose the ReportDocument
rpt.Close();
rpt.Dispose();
And then assign nulls to the ReportViewer
and dispose.
CRViewer.ReportSource=null;
CRViewer.Dispose();
CRViewer=null;
And finally, you have to do the two pass GC collect.
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Please note that it is generally not recommended to call GC.Collect() but sometimes when memory is too much of an issue and third party COM component's like crystal report has issue with getting disposed properly, we may have to go this route.