Page 1 of 1

Memory leak when using TTeeGDIPlus

Posted: Thu Jun 10, 2010 9:38 am
by 16556135
Hi,

it seems there is a memory leak when using TTeeGDIPlus. It can be reproduced in the sample project (Delphi 2010) I've attached.
Just run the code and then resize the form a couple of times and then close it. I've also attached a screenshot of the FastMM report that pops up.

I think it's caused by TGDIPlusCanvas.InitWindow() which is called by the draw routine.

It creates a TTeeCanvas3D object each time it is called but doesn't free it
...
begin
IXORCanvas:=TTeeCanvas3D.Create;

Could you please take a look at it?

Regards,
Amadeus

Re: Memory leak when using TTeeGDIPlus

Posted: Thu Jun 10, 2010 12:02 pm
by 16556135
While I'm at it: seems there's another one in Chart.pas ->TLegendSymbol.Draw()

OldBrush:=TBrush.Create;

OldBrush doesn't get freed.

Re: Memory leak when using TTeeGDIPlus

Posted: Fri Jun 11, 2010 10:30 am
by yeray
Hi Amadeus,

You are right. I could reproduce it so I've added it to the defect list to be revised in future releases (TV52014961).
Thanks for reporting it.

Re: Memory leak when using TTeeGDIPlus

Posted: Fri Jun 11, 2010 1:26 pm
by narcis
Hi Amadeus,
While I'm at it: seems there's another one in Chart.pas ->TLegendSymbol.Draw()

OldBrush:=TBrush.Create;

OldBrush doesn't get freed.
Yes, we found that some weeks ago and fixed it for the next maintenance release.

Re: Memory leak when using TTeeGDIPlus

Posted: Tue Jun 15, 2010 2:17 pm
by narcis
Hi Amadeus,

Just wanted to let you know that TV52014961 has been fixed for the next maintenance release. To fix this you can add line below to GDI+ canvas constructor (TGDIPlusCanvas.Create) and remove it from TGDIPlusCanvas.InitWindow.

Code: Select all

  IXORCanvas:=TTeeCanvas3D.Create;

Re: Memory leak when using TTeeGDIPlus

Posted: Wed Jun 16, 2010 8:41 am
by 16556135
Yes, this does the trick.
Thanks for the quick help. It's appreciated

Re: Memory leak when using TTeeGDIPlus

Posted: Wed Jun 16, 2010 8:45 am
by narcis
Kubach,

You're very welcome. Thanks for your feedback too!