Memory leak in v.8.01

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Miket
Newbie
Newbie
Posts: 23
Joined: Thu Apr 15, 2004 4:00 am
Location: Russia, Moscow
Contact:

Memory leak in v.8.01

Post by Miket » Sat Jun 30, 2007 12:13 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jul 02, 2007 7:38 am

Hi Michael,

Thanks for your suggestion but BackupPen is already freed in TPenDialog.FormDestroy.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Miket
Newbie
Newbie
Posts: 23
Joined: Thu Apr 15, 2004 4:00 am
Location: Russia, Moscow
Contact:

Post by Miket » Mon Jul 02, 2007 9:22 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jul 02, 2007 11:47 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply