Hello all (and especially Paul Ishenin since it's your fix I'm referring to),

http://bugs.freepascal.org/view.php?id=7749

This was recently marked as fixed for gtk2 in the Lazarus trunk. I
pulled from svn this morning and built everything and put together a
quick test program.

Basically I created a form and dropped a TListView onto it and set the
OwnerData property to True, then defined an OnData event like:

procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem);
begin
  Item.Caption := 'Item ' + IntToStr(Item.Index + 1);
end;

Then in the FormCreate I set the Items.Count property to some value:

procedure TForm1.FormCreate(Sender: TObject);
begin
  ListView1.Items.Count := 10;
end;

I ran the program and sure enough, the list showed up with my items
with the correct caption. Great!

However, for the purposes of testing, I then increased the count to
1000000, since a major purpose of a virtual list view is so you don't
have to eat up all your memory storing the items.

To my dismay, when I ran the program, it ran correctly, but the memory
usage of my program was huge compared to when I only had 10 items.

I put some writeln's in the OnData method and also discovered that
that the OnData routine was called, on startup of my program, for each
of my million items.

Am I doing something wrong? Is there some other way I'm supposed to
set the number of items for my list rather than setting Items.Count? I
tried looking at the revision changes
(http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&root=lazarus&revision=22789)
and didn't see any other way.

I don't have a setup to test other widgetsets (windows, carbon,
whatever). Is this the behavior for other widgetsets?

Anyway, I wanted to discuss it here before I comment on or reopen the
issue to make sure I don't have a misunderstanding of the expected
behavior. While it does technically work (it calls the OnData method)
it seems one of the major draws of using a virtual control is defeated
by the huge memory usage I'm seeing.

And, by the way, thanks so much for the work and effort of the Lazarus
development team.

-SG

--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover
sethdgrover[at]gmail[dot]com

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to