[fpc-pascal] TFPObjectlist example
Ryan Joseph
genericptr at gmail.com
Mon Sep 7 04:21:03 CEST 2020
> On Sep 7, 2020, at 6:07 AM, James Richters via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> Does anyone have an example of how to use TFPObjectlist?
It just frees objects that are removed from the list (or when the list is freed).
list:= TFPObjectlist.Create;
list.Add(TObject.Create);
list.Free;
in that example the object added to the list won't leak memory but it will be freed when the list itself is freed.
or
list:= TFPObjectlist.Create;
list.Add(TObject.Create);
list.Delete(0);
will also not leak memory.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list