[fpc-pascal] collection memory usage...

waldo kitty wkitty42 at windstream.net
Sat Oct 27 22:56:04 CEST 2012


On 10/27/2012 16:23, Tomas Hajny wrote:
[trim]
>> *if i'm reading this properly*, what is confusing me is the first one
>> allocates less memory blocks and uses more heap whereas the second one
>> allocates (a lot) more memory blocks (55000 more??) but uses much less
>> heap...
>
> The number of blocks is higher in the second case because a new memory
> block is allocated for each record added to the collection (initial
> collection size is 1, the size is increased by one record whenever the
> allocated size is fully used and a new record shall be added).

ahhh... ok, so that's "number of records" to start with and "number of records 
to increase by"...

>> However, I'm not clear why you think that less heap is used in the
>> second case?

because "true heap size" is different between them... i am thinking that this is 
the total amount of heap used by the program during its run??

>> so i'm trying to figure out the best set of init numbers for the
>> collections...
>> i'm wanting the fastest run time with the smallest memory usage... am i
>> understanding this correctly??
>
> Considering the number of records you suggested above, I'd go for
> something like 20000 records as the initial collection size and e.g. 2000
> or even 5000 as the increment.

ok... i'll give that a try and see what happens... thanks very much for your 
response!

FWIW: i had asked this some several months back but was probably not as clear in 
my request... it may have also been in the wrong area but i didn't get any 
response to it so i just left it alone to ask later ;)



More information about the fpc-pascal mailing list