I found a little memory leek in Chart.pas, method TLegendSymbol.Draw.
The local variable "OldBrush" will never be released.
Code: Select all
Report FastMM Fulldebugmode
******************************
--------------------------------2010/6/21 16:14:11--------------------------------
A memory block has been leaked. The size is: 36
This block was allocated by thread 0x628, and the stack trace (return addresses) at the time was:
403402 [sys\system.pas][System][System.@GetMem][2654]
4045FB [sys\system.pas][System][System.TObject.NewInstance][8807]
4049CA [sys\system.pas][System][System.@ClassCreate][9472]
44403E [Graphics.pas][Graphics][Graphics.TBrush.Create][2191]
40BC89 [FastMM4][FastMM4.UpdateHeaderAndFooterCheckSums][4439]
77D6E9 [Chart.pas][Chart][Chart.TLegendSymbol.Draw][3815]
404A38 [sys\system.pas][System][System.@AfterConstruction][9520]
77D06C [Chart.pas][Chart][Chart.TCustomChart.DrawLegendShape][3589]
76B980 [TeEngine.pas][TeEngine][TeEngine.TChartSeries.DrawLegendShape][10097]
792E0C [Series.pas][Series][Series.TCustomBarSeries.DrawLegendShape][3885]
76BB85 [TeEngine.pas][TeEngine][TeEngine.TChartSeries.DrawLegend][10171]
The block is currently used for an object of class: TBrush
Code: Select all
Code (Chart.pas)
******************
procedure TLegendSymbol.Draw(AColor: TColor; const R:TRect);
var tmp : TCanvas3D;
tmpR : TRect;
OldBrush : TBrush;
begin
tmp:=Parent.Canvas;
OldBrush:=TBrush.Create; //<-- Created but never deleted
OldBrush.Assign(tmp.Brush);
if FShadow.Visible and (FShadow.Size<>0) then
FShadow.Draw(tmp,R);
tmp.Brush.Assign(OldBrush);
if not DefaultPen then // 8.01
tmp.AssignVisiblePen(Pen);
if Gradient.Visible then
begin
Gradient.EndColor:=AColor;
Gradient.Draw(tmp,R);
tmp.Brush.Style:=bsClear;
end
else
begin
tmp.Brush.Color:=AColor;
end;
if tmp.Pen.Style<>psClear then
tmp.Rectangle(R)
else
if tmp.Brush.Style<>bsClear then
begin
tmpR:=R;
Inc(tmpR.Right);
Inc(tmpR.Bottom);
tmp.Rectangle(tmpR)
end;
end;
With best regards
Tom Mueller