[fpc-pascal] TFPList.Expand was: Maximum of memory which can be used by single program in 32 bit Windows

LacaK lacak at zoznam.sk
Fri May 20 10:24:38 CEST 2016


> 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.




More information about the fpc-pascal mailing list