[fpc-pascal] TFPSList clear but not shrink
Ryan Joseph
genericptr at gmail.com
Sun Aug 18 16:43:51 CEST 2019
Is it possible to remove or clear items from TFPSList without actually shrinking the memory (i.e. setting capacity to 0)? Looking the source below I see every time I clear the list it the capacity is set to 0 also. This is fine most of the time unless you want to reuse the list without reallocating memory.
If it’s not possible can I make a patch to include this option?
procedure TFPSList.Clear;
begin
if Assigned(FList) then
begin
SetCount(0);
SetCapacity(0);
end;
end;
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list