cancel
Showing results for 
Search instead for 
Did you mean: 

memory leak with windows service

Former Member
0 Kudos

Hi,

comparable to description of , I still do have the same problem.

The application runs as a windows service on Windows Server 2012.

I'm using Crystal Report v13.0.13 for .NET (x64 , Framework 4.5.2) with visual studio 2013.

Accourding to the "Fixed issues" at http://scn.sap.com/docs/DOC-7824 this problem has not been fixed in th newer releases.

The problem exits since we migrated the project from 32-bit to 64-bit and from VS 2008 to VS2013.

It is definitly Crystal R. that does not free the memory correctly.

Which further informations do you need to fix this bug?

Thanks in advance!

View Entire Topic
DellSC
Active Contributor
0 Kudos

The thing to remember is that the Crystal and BO SDKs are based on COM objects, which can cause memory leaks if not handled correctly.  So, when possible, you should either enclose calls to a report in the SDK with a "using" clause, or explicitly call .dispose() on the report when you're done with it.

-Dell

Former Member
0 Kudos

Thank you for your fast response. Unfortunately that's what I am already doing: .Dispose() on the Crystal R.-object and additionally on the DataSet and tables.

{

    [...]

        try
        {
            [...]
            crReportDocument = new ReportDocument();
            crReportDocument.Load(pathReport);
            crReportDocument.SetDataSource(dsData);
            crReportDocument.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
            crReportDocument.SetParameterValue("finalized", false);

            if (myDestination.Equals(DestinationChoice.toDisk))
            {
                crReportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, fileWithPath);
            }
            else if (myDestination.Equals(DestinationChoice.toHttpResponse))
            {
                crReportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, true, filename);
            }
        }
        catch (Exception ex)
        {
            throw ex.ToString();
        }
        finally
        {
            if (crReportDocument != null)
            {
                crReportDocument.Close();
                crReportDocument.Dispose();
            }
            tabMaindata.Clear();
            tabMaindata.Dispose();
            tabSubrpdata.Clear();
            tabSubrpdata.Dispose();
            dsData.Clear(); //DataSet contains tabMaindata and tabSubrpdata
            dsData.Dispose();
        }
    }