Memory usage when compiling large reports (PreviewPages.AddFrom and PrepareReport)
I have a project where a single report is created by looping through our customer table and for each customer:
- Populate a dataset with customer transactional information
- Call PrepareReport(false) to append the information for this customer to the report
Each time we call PrepareReport(false) the time taken to complete the process increases which blows the reporting process out drastically.
To overcome this I have attempted to implement a method where there are two TfrmReport objects.
Each customer's data is passed to PrepareReport(true) on TfrxReport number 1, and then I use PreviewPages.AddFrom to append to the main TfrmReport.
This works well and fixes the speed issue. However, it re-introduces another issue experienced previously with FastReports where the memory usage would run away until an 'Out of memory' errors.
This was corrected previously by setting EngineOptions.UseFileCache := True; and PreviewOptions.PictureCacheInFile := True;
Does anyone have an example of how this kind of operation can be completed efficiently without excessive memory usage?
This issue exists in both Delphi 2006 and Delphi 10.4
Comments
Does anyone have an example of how this kind of operation can be completed efficiently without excessive memory usage?
No, FR doesn't have other features. Create 64-bit application to prevent 'Out of memory' errors