Page 1 of 1

TeeSaveToJPEGFile produces memory leak

Posted: Fri Mar 01, 2013 8:31 am
by 10049140
Hi.

I am using the latest version of TeeChart Pro (2012.07.121105) with Delphi XE2 (Update 4).

When I close my application after saving my chart to a JPG image using the method TeeSaveToJPEGFile() from unit "Teejpeg" I got this memory leak reported:
Image

Note: In the Delphi Application you have to set ReportMemoryLeaksOnShutDown := True; to get this kind of memory leak report.

Is this a known issue?
Could you provide a fix for this?

Please let me know if you need any further information or a simple sample project to reproduce.
Best regrads.

Re: TeeSaveToJPEGFile produces memory leak

Posted: Fri Mar 01, 2013 10:39 am
by yeray
Hi marder,

I can reproduce it with v2012.07 but not with the actual sources we have here.
I think it was fixed when changing, in TeeJPEG.pas:

Code: Select all

Function TJPEGExportFormat.Jpeg(const AOptions:TTeeJPEGOptions):TJPEGImage;
var Params : TJPEGDefaults;
begin
  { returns a JPEG image using the "Panel" (Chart) property }
  if not Assigned(Panel) then
     Raise Exception.Create(TeeMsg_ExportPanelNotSet);

  CheckProperties;

  { set JPEG options }
  Params:=JPEGDefaults;

  if Assigned(AOptions) then FProperties:=AOptions;

  Params.GrayScale:=FProperties.CBGray.Checked;
  Params.CompressionQuality:=FProperties.UpDown1.Position;
  Params.Performance:=TJPEGPerformance(FProperties.RGPerf.ItemIndex);

  CheckSize;

  { obtain a JPEG image using parameters }
  result:=TeeGetJPEGImageParams(Panel,Params,0,0,Width,Height);
end;
For this:

Code: Select all

Function TJPEGExportFormat.Jpeg(const AOptions:TTeeJPEGOptions):TJPEGImage;
var Params : TJPEGDefaults;
begin
  { returns a JPEG image using the "Panel" (Chart) property }
  if not Assigned(Panel) then
     Raise Exception.Create(TeeMsg_ExportPanelNotSet);

  if Assigned(AOptions) then FProperties:=AOptions
                        else CheckProperties;

  { set JPEG options }
  Params:=JPEGDefaults;

  Params.GrayScale:=FProperties.CBGray.Checked;
  Params.CompressionQuality:=FProperties.UpDown1.Position;
  Params.Performance:=TJPEGPerformance(FProperties.RGPerf.ItemIndex);

  CheckSize;

  { obtain a JPEG image using parameters }
  result:=TeeGetJPEGImageParams(Panel,Params,0,0,Width,Height);
end;

Re: TeeSaveToJPEGFile produces memory leak

Posted: Fri Mar 01, 2013 11:47 am
by 10049140
Ok.
Could you confirm that this new code will make it to the next official release of TeeChart Pro?
In this case this will be good enougth for us.

Thanks and best regards.

Re: TeeSaveToJPEGFile produces memory leak

Posted: Fri Mar 01, 2013 1:11 pm
by yeray
Hi,

Yes, being in the actual sources we have here means it would be in a release if we prepared one. And I see no reason why anyone would revert this change.