Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I've been tracking down a memory leak for a little while now. I have isolated it to unmanaged memory, and what appears to be inside Crystal Reports ExportToStream method (using Crystal Report XI Release 2, VS 2005, .NET 2.0).

My service produces a large number of reports as pdf's, and at about 10,000 I'm running out of memory. Mind you, my report is rather large (approximately 18 pages), but I'm currently leaking approximately 33k per report. My datasets and report objects are wrapped in usings, and all managed memory heaps are kept in check. The main culprit appears to be ExportToStream.

Here's the sample code:

C#
using (DataSet dst = new DataSet())
{
    dst.ReadXml(@"c:\temp\data.xml", XmlReadMode.ReadSchema);

    using (ReportClass rpt = new TestReport())
    {
        rpt.SetDataSource(dst);
        rpt.Refresh();

        using (Stream stm = rpt.ExportToStream(ExportFormatType.PortableDocFormat))
        {
            // ...
        }

        rpt.Close();
}


If I comment out the ExportToStream, my managed and unmanaged memory is fine. If I leave it in, my unmanaged memory grows until I eventually run out.

I'm currently using MemProfiler to keep track of the memory, and it brought up that there are EventHandlers that remain attached, and are not being released. The only problem is that it appears to be deep in Crystal Reports code. It's complaining about events on InternalEnterpriseLogonInfo - ReportID - ReportClientDocumentWrapper. Has anyone else experienced this?

These events are different than the old Crystal events bug as reported here:
[Crystal memory leak]

My next thought is to try to force this to run in it's own memory space somehow, but I'm not sure how to do that.

Any ideas on a solution or work around?
Posted
Updated 3-Nov-10 10:53am
v3

Which version of Visual Studio and .NET are you using? IIRC, XI R2 was only supported on .NET 1.0 and 1.1 (VS 2002 and 2003). I could be wrong as I don't use CR. Too many problems with it! ;)
 
Share this answer
 
It is a known bug. No workaround till now. Sorry.
 
Share this answer
 
Any one found any solution for this issue ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900