What about to simply adjust Expand procedure like:

 if FCapacity > 8*1024*1024 then IncSize := FCapacity shr 3
 else if FCapacity > 128 then IncSize := FCapacity shr 2
 else if FCapacity > 8 then IncSize := 16
 else IncSize := 4;
 SetCapacity(FCapacity + IncSize);

It does not solve your problem at a fundamental level.

Yes it is only kind of approximation and balancing "optimal step" between "less reallocation" and "more memory" Which is application dependant, but may be that there are less applications, which will handle billions items in TFPList and which will need expand by 25% to save rellocations. IMO it is reasonable for large number of items decrease "step" as saving memory will give higher gain for most applications.


Maybe it does today, but in a year you will again bump into this problem, if
your file grows. Then what ?

In my case it will not happen ;-)), size is stable and will not change

-Laco.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to