BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TMS TAdvColumnGrid Memleak + workaround

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools
View previous topic :: View next topic  
Author Message
Bertus
Guest





PostPosted: Wed Dec 20, 2006 3:21 pm    Post subject: TMS TAdvColumnGrid Memleak + workaround Reply with quote



(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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.