Memory leak patch for TCustomTeePanel.CreateDefaultCanvas

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
VasekC
Newbie
Newbie
Posts: 3
Joined: Tue May 21, 2013 12:00 am

Memory leak patch for TCustomTeePanel.CreateDefaultCanvas

Post by VasekC » Wed Jun 19, 2013 11:49 am

Hi,
there is small but not welcomed memory leak in TeeProcs.TCustomTeePanel.CreateDefaultCanvas. When InternalCanvas is already set but has different ClassType, it is not freed but only replaced by another one. Such a way (in my case) one TTeeCanvas3D and one TTeeGradient is not freed for each instantiated Chart. I put InternalCanvas.Free before creation and assigning of the new Canvas, here is the patch:

Index: VCLTee.TeeProcs.pas
===================================================================
--- VCLTee.TeeProcs.pas (revision 315)
+++ VCLTee.TeeProcs.pas (working copy)
@@ -1813,6 +1813,7 @@

if (not Assigned(InternalCanvas)) or (tmpClass<>InternalCanvas.ClassType) then
begin
+ InternalCanvas.Free;
InternalCanvas:=tmpClass.Create;
InternalCanvas.ReferenceCanvas:=FDelphiCanvas;
end;

I'm using 2013 Pro +src version of VCLTee

Good luck

Vasek

ulibru
Newbie
Newbie
Posts: 11
Joined: Mon Dec 10, 2012 12:00 am

Re: Memory leak patch for TCustomTeePanel.CreateDefaultCanvas

Post by ulibru » Wed Jun 19, 2013 4:01 pm

Thanks Vasek,

this also solves the problem I have reported in my post http://www.teechart.net/support/viewtop ... =3&t=14131

Uli

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

Re: Memory leak patch for TCustomTeePanel.CreateDefaultCanvas

Post by Narcís » Fri Jun 21, 2013 7:09 am

Hello Vasek,

Thanks. Yes, you are right. We already had fixed that in our internal sources for the next 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