 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bertus Guest
|
Posted: Wed Dec 20, 2006 3:21 pm Post subject: TMS TAdvColumnGrid Memleak + workaround |
|
|
(This may also count for TAdvStringGrid)
Reproduce:
Put TAdvColumnGrid + button on form.
In the Button OnClick put this:
procedure TForm1.Button1Click(Sender: TObject);
var
ColNr : Integer;
RowNr : Integer;
begin
//Use this
for ColNr:=1 to AdvColumnGrid1.ColCount do
AdvColumnGrid1.Cells[ColNr,1]:='';
//Instead of this --> will leak memory
//AdvColumnGrid1.Rows[1].Clear;
//or this --> will leak memory
//AdvColumnGrid1.Rows[1].Text:='';
AdvColumnGrid1.RowCount:=2;
for RowNr:=1 to 10 do
begin
if RowNr>=(AdvColumnGrid1.RowCount-1) then
AdvColumnGrid1.RowCount:=RowNr+1;
for ColNr:=1 to AdvColumnGrid1.ColCount do
begin
AdvColumnGrid1.Cells[ColNr,RowNr]:=IntToStr(ColNr*RowNr);
end;
AdvColumnGrid1.RowColor[RowNr]:=rgb(Random(255),Random(255),Random(255));
end;
end;
Start program and push button rapidly serveral times. You will notice a
memleak in the tasklist when using any of the 'bad' clearing methods.
The leak appears when clearing a row in the grid and changing the
rowcolors after that. Workaround is to clear each cell separately
instead of using row.clear or row.text:=''.
Please post a followup if this has helped anyone.
Bert |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|