Board index » delphi » String List Objects Property

String List Objects Property

I have downloaded a couple of List Box components that have check boxes added
to them.  They all use the objects property of the stringlist but I cannot see
any of them actually freeing the objects they create and assign to the objects
array.

So...  Does the string list take care of this itself - I cannot see this as it
cannot free something that it only refers to by a pointer, there may be other
pointers to the same object.

If all of these check list box components I have downloaded are not freeing
the objects that they create then there are memory leakage problems for anyone
using them.

Is there an event on the listbox (or stringlist) that could be used when
deleting items or clearing the list box, so you can attach a routine to delete
the objects pointed to by the objects array ?  Or is it a matter of manually
deleting them around the calls to clear or delete items from the listbox ?

Any thoughts ?

--
Andrew Porter

The path of excess leads to the tower of wisdom.

 

Re:String List Objects Property


_________________________________________

I always think it's good programming practice to explicitly free any
objects I create - and it takes very little code (and no appreciable time)
to iterate through a list and do this.

So far as I'm aware it is a case of manually freeing these objects when
manipulating the list length or exiting the unit.

Like you I've noted that some components don't do this, and it's been a
source of some (minor) concern. But I haven't witnessed any drastic
consequences of this oversight.

Regards ...
_________________________________________

  ?  Leigh Harrison      
  ?  tel +64 6 343 2671
  ?  fax +64 6 343 2649
  ?  mobile 025 933 913
  ?  email le...@radiOshop.co.nz
  ?  3 Iris Place Wanganui New Zealand
_________________________________________
                             radiOshop

Andrew Porter <a...@defsdoor.demon.co.uk> wrote in article
<874948934.20581.0.nnrp-05.c2de3...@news.demon.co.uk>...

Quote
> I have downloaded a couple of List Box components that have check boxes
added
> to them.  They all use the objects property of the stringlist but I
cannot see
> any of them actually freeing the objects they create and assign to the
objects
> array.

> So...  Does the string list take care of this itself - I cannot see this
as it
> cannot free something that it only refers to by a pointer, there may be
other
> pointers to the same object.

> If all of these check list box components I have downloaded are not
freeing
> the objects that they create then there are memory leakage problems for
anyone
> using them.

> Is there an event on the listbox (or stringlist) that could be used when
> deleting items or clearing the list box, so you can attach a routine to
delete
> the objects pointed to by the objects array ?  Or is it a matter of
manually
> deleting them around the calls to clear or delete items from the listbox
?

> Any thoughts ?

> --
> Andrew Porter

> The path of excess leads to the tower of wisdom.

Re:String List Objects Property


In article <874948934.20581.0.nnrp-05.c2de3...@news.demon.co.uk>,

Quote
a...@defsdoor.demon.co.uk (Andrew Porter) writes:
>So...  Does the string list take care of this itself - I cannot see this as
>it
>cannot free something that it only refers to by a pointer, there may be other
>pointers to the same object.

See the Help with Ojects and Dynamic Allocation thread

Alan Lloyd

Other Threads