Link to home
Start Free TrialLog in
Avatar of MBL1175
MBL1175

asked on

Crystal Reports v10, & Delphi 5 possible Memory Leak

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
      begin
        SetApplicationReportPath(Application.Title);
        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
      end;
    Cryst.Free; // frees up 5MB
--------------------------------------------
Cheers
Ray
Avatar of developmentguru
developmentguru
Flag of United States of America image

 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.
ASKER CERTIFIED SOLUTION
Avatar of DanSo1
DanSo1
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial