Page 1 of 1

Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Wed Apr 12, 2023 12:36 pm
by 16594319
Hi all,

We experience Out Of Memory Exceptions when we print TChart (export to PDF) in our concurrent server environment.
I've managed to create an example application.

What I see is, when using ReportBuilder + Standard TeeChart delivered with Delphi, all seems to be OK.
When I install the TeeChart-pro version (rebuild TeeReCompile and RBTeePackageBuilder) and run the same application (rebuilded) I can reproduce 'Out Of Memory' quite frequent.


Precompiled binaries to try: https://we.tl/t-XAJMhrXBrM

To repoduce:
  • Open ReportBuilder_Test.exe (one of the 2 different compiled executables)
  • Hit button 'Start'
  • Exceptions will be logged, if none arise, try some times again.
I experience easier reproduction on my host-machine compared to run in a virtual environment.
Until now I didn't get the 'RBuilderTeeChartDelphi' example to break, but the 'RBuilderTeeChartPro' breaks quite easily.

Version info:
Delphi: 11.3.1
ReportBuilder: 22.01
TeeChart: 2023.38-beta

Sourcecode: in attachment (ReportBuilder.zip)
Callstack: in attachment (callstack.png)

Many thanks in advance!

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Thu Apr 13, 2023 3:55 pm
by Marc
Hello,

Thank you for the problem description and sample application. We are able to run your project and reproduce the error you report. The issues have some complexity so it will likely take us some time to work through possible causes. We'll get back to this thread.

Regards,
Marc Meumann

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Thu Apr 13, 2023 5:52 pm
by 16594319
Thank you Marc, please let me know the result.

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Fri Apr 14, 2023 7:15 am
by Marc
As a follow-up whilst we're looking at this. The problem doesn't seem to occur when tested with GDI (not GDI+).

If you'd like to test it, to see whether the output is at a level that is acceptable to you, the quickest way, if you're compiling with TeeChart sourcecode, is to set the default canvas here:

unit VCLTee.TeeProcs;

Code: Select all

initialization
  //TeeDefaultCanvas:={$IFDEF FMX}''{$ELSE}'TGDIPlusCanvas'{$ENDIF}; //commenting this line

  TeeDefaultCanvas:='';  //<- adding this line

...
There's a registry setting that controls that I think; I'll need to check, but the sourcecode mod will let you test it.

Regards,
Marc

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Fri Apr 14, 2023 11:03 am
by 16594319
Hi Marc,

Yes I can confirm that switching to GDI don't give us errors (until now)!
With developer-eyes the generated images are still good enough :D

I had some troubles setting up to build with source, can you confirm the steps to do?
  • Add VCLTee to unit scope names
  • Add Source\VCL to library path (not source\ itself)
  • Add RBuilder\Source to library path (as we use RBuilder to print the charts)
Do I understand correctly that you're still looking for a final solution?

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Fri Apr 14, 2023 1:44 pm
by Marc
Yes, we'll run some checks. GDI+ is known to suffer problems when many handles are requested via multiple threads but we are curious that it should have behaved differently with the TeeChart Standard version shipped with Delphi so we'll look for differences.

Regards,
Marc

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Fri Apr 14, 2023 1:52 pm
by Marc
Reviewing your steps:

Add VCLTee to unit scope names
Yes.

Add Source\VCL to library path (not source\ itself)
Yes, the Source\VCL folder. At project level: Project Options, Building, Delphi Compiler Search path.

Add RBuilder\Source to library path (as we use RBuilder to print the charts)
Yes, again, at project level, added this folder to the Search path too:
..program files ..\Embarcadero\Studio\20.0\RBuilder\TeeChart\Win32\TeePro900

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Wed May 10, 2023 6:54 am
by 16594319
Hi,

I just see beta2 (2023.38.230508) is rolled out.
Should this version fix these GDI+ errors?

Re: Out Of Memory printing TeeChart (Delphi / ReportBuilder (Digital Metaphors)

Posted: Fri May 12, 2023 9:31 am
by yeray
Hello,

I'm afraid there's still a problem with using GDIPlus in multiple threads.
Since metafile doesn't require GDIPlus, the workaround is to set GDI canvas.