We help IT Professionals succeed at work.

Crystal Reports v10, & Delphi 5 possible Memory Leak

MBL1175 asked
Last Modified: 2009-07-29
XP, Crystal Reports v10, & Delphi 5 possible Memory Leak
When launched for the first time, the following process grabs 29MB of memory and releases 5MB.
Each time the report process is subsequently re-launched, additional memory(between 1MB & 2MB) is grabbed and retained.
The 24MB retained from the initial launch of the report appears to be re-used each time a crystal report is launched, so that's not an issue, it's just the extra 1 or 2MB eaten up every time a report is launched.
How can I get it back without having to close down the application?
    Cryst := TCrysPreview.Create(nil);   // uses 630K
    With Cryst do
        ReportName := trim(Q.FieldByName('REPORT_FILE').AsString)+'.RPT';
        SetReport;  // uses 16.3MB
        Report.Database.SetDataSource(RQ.Recordset,3,1);  // uses 8.7MB
        ShowModal;  //uses 4MB
    Cryst.Free; // frees up 5MB
Watch Question


 One suggestion I can give you is to use EurekaLog.  You can set it up to watch for memory leaks and report to you the entire call stack leading to a memory leak, and which statement causes it.  Ideally you would need source to the crystal components to get the most benefit.  I believe I padi the $299.00 for EurekaLog (includes source that way).  It can be found at www.eurekalog.com.  Another bonus is that you can compile it into your applications that go out to the field.  If any exception makes it to the top of the call stack it can send you the entire call stack that led to the exception and the line that caused it.  You can even set it up to email you these details and a screen shot of their system when it happend :-)

Anothe rsuggestion, from my own memory leak issues, is to create your Cryst as follows:
   Cryst := TCrysPreview.Create(Form1);   // uses 630K
What I ran into was that creating any data sources TADOQuery, TADOTable, passing nil as the owner will cause the Delphi code to cause a memory leak.  This could also be true for Crystal.  Try it out and let me know.
This one is on us!
(Get your first solution completely free - no credit card required)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.