Page 1 of 1

Memory leak in v.8.01

Posted: Sat Jun 30, 2007 12:13 pm
by 9337075
Hello,

I just discovered a small memory leak in TeeChart v. 8.01 (June 26).

File TeePenDlg.pas,

procedure TPenDialog.FormShow(Sender: TObject);

The first 2 lines (line 221 and 222) should be
================
if not Assigned(BackupPen) then
BackupPen:=TChartPen.Create(nil);
================

The reason is that FormShow event can be called many times in the Chart Editor for the same TPenDialog form, causing repetitive construction of BackupPen.

Sincerely,
Michael

Posted: Mon Jul 02, 2007 7:38 am
by narcis
Hi Michael,

Thanks for your suggestion but BackupPen is already freed in TPenDialog.FormDestroy.

Posted: Mon Jul 02, 2007 9:22 am
by 9337075
Hi Narcis,

Yes, I know that it is freed in OnDestroy. The problem is that OnShow event can be called many times for the same form (example: TChartEdit dialog with multiple series), but OnDestroy will be called only ONCE!

You can convince yourself in the fact, that there is a memory leak here with FastMM in debug mode!

If necessary, I can prepare a soimple test case.

Regards,
Michael

Posted: Mon Jul 02, 2007 11:47 am
by narcis
Hi Michael,

Thanks for the information. Yes, you are right. This seems to be a small VCL leak as it calls OnShow several times where it should only be done once.

Anyway we are going to try to fix it for the next maintenance release.