Memory Leak with TPNGExportFormat

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MHotz
Newbie
Newbie
Posts: 12
Joined: Mon Nov 25, 2013 12:00 am
Contact:

Memory Leak with TPNGExportFormat

Post by MHotz » Wed May 14, 2014 10:01 am

TeeChart Pro v2014.10.140220 32Bit VCL
Delphi XE5

Hi!

I am currently scanning my project for Memory Leaks with FastMM4. I have some and among those is one that's related to TPNGExportFormat. My code that produces the leak is:

Code: Select all

procedure SaveChartToStream;
  var
    tmp: TPNGExportFormat;
  begin
    try
      tmp := TPNGExportFormat.Create;
      tmp.PixelFormat := pf32bit;
      tmp.Compression := 4;
      tmp.Panel := MyChart;
      tmp.SaveToStream(MyStream);
    finally
      tmp.Free;
    end;
  end;
The info for this in the FastMM4 report is:
A memory block has been leaked. The size is: 68

This block was allocated by thread 0x18ED8, and the stack trace (return addresses) at the time was:
406C76 [WPRTEDefs.pas][System][@GetMem$qqri][56653]
4089F3 [WPRTEDefs.pas][System][TObject.NewInstance$qqrv][56653]
4091E2 [WPRTEDefs.pas][System][@ClassCreate$qqrpvzc][56653]
5379A6 [Vcl.Graphics][Graphics.TBitmap.$bctr$qqrv]
9F520C [VCLTee.TeeProcs][Teeprocs.TCustomTeePanel.TeeCreateBitmap$qqr21System.Uitypes.TColorrx18System.Types.TRect25Vcl.Graphics.TPixelFormati]
AA917B [VCLTee.TeePNG][Teepng.TPNGExportFormat.Bitmap$qqrv]
AA9254 [VCLTee.TeePNG][Teepng.TPNGExportFormat.SaveToStreamCompression$qqrp22System.Classes.TStreami]
5A29A3 [Vcl.ComCtrls][Comctrls.TCustomUpDown.GetPosition$qqrv]
AA92DA [VCLTee.TeePNG][Teepng.TPNGExportFormat.SaveToStream$qqrp22System.Classes.TStream]
BB8267 [RPObjectAttributes.pas][RPObjectAttributes][SaveChartToStream][2826]
BB86A2 [RPObjectAttributes.pas][RPObjectAttributes][TObjectListe.CreateInteractiveFormat$qqrp19Vcltee.Chart.TChartxixoxi][2931]

The block is currently used for an object of class: TBitmap
I tried the above mentioned code in a seprate project and no leak occurs. So do you have any idea why the TBitmap that is created in VCLTee.TeeProcs.TCustomTeePanel.TeeCreateBitmap isn't freed?

Thanks a lot for your support!

Regards
Markus

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Memory Leak with TPNGExportFormat

Post by Yeray » Thu May 15, 2014 1:28 pm

Hello Markus,

I've made a simple example project using the code you mentioned
testPNGMem.zip
(228.79 KiB) Downloaded 462 times
I've linked this project to TeeChart v2014.10 sources and FastMM4 tells me there's a Memory Leak, but not the same than you.
Find the Project1_MemoryManager_EventLog.txt in the project's Win32\Debug folder.

Am I doing anything different than you?
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply