Skip to Content
avatar image
Former Member

Why I get an "out of memory" after loading like 32 760 reports?


I have a WCF web service done in VB.Net with Visual studio 2010 and Crystal Report for Visual studio with runtime The web service need to generate 41000 reports in PDF , but after like 32760 reports, I always get an "Out of memory" message. I have the exact same problem of this archived post : . I can simulate the same behavior with this simple application :

Dim i As Integer = 0 
While (i < 40000) 
    Dim monTestMemory As TestMemoryLeak = New TestMemoryLeak() 
    monTestMemory.Load("TestMemoryLeak.rpt") ' 
    monTestMemory = Nothing
    lblEtat.Content = "Rapport : " + i.ToString() i = i + 1
End While Catch ex As Exception
    MessageBox.Show(ex.Message + " " + ex.StackTrace) 
End Try

This simple application will always do an exception around the loading of the report 32760.

Someone have any idea how to make this to work?

Thank you in advance!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 29, 2018 at 05:13 PM

    The Crystal SDK is based on COM objects and .NET does not memory manage COM very well. You have to force it to release the memory, even though you're correctly using .Dispose(), by adding this line after .Dispose() and before assigning it to nothing:



    Add comment
    10|10000 characters needed characters exceeded

  • Apr 05, 2018 at 04:17 PM

    And time to upgrade to a more current version of the runtime:

    Also from the error it suggest you are not releasing the Reports after each use and the count just keeps going up. Clean up your objects as Dell indicated.


    Add comment
    10|10000 characters needed characters exceeded