Re: memorymanager/fastmm question/suggestion



Hi Ben,

> would it make sense to have a FastSetLength(str,length,blocksize)
> function, where blocksize is a 'hint' to fastmm for the blocksize to
> allocate/reserve.

That wouldn't be hard to implement.

> thoughts? would it be worthwhile?

The problems I foresee are:
1) How do you prevent the memory manager from reallocating it to a smaller
block if the result of the first string addition is much smaller than
"blocksize"? I suppose you could have a flag in the block header that tells
it never to downsize that block.
2) It would slow down assignments of the type str1 := str2. To maintain a
minimum block size, strings will need to be copied more often (instead of
just bumping the reference count of str2).
3) It would require some changes to the RTL. If str1 is currently blank,
then something like str1 := str1 + str2 translates to str1 := str2, and the
RTL calls LStrAsg for that... again the reference count / copy problem..

Regards,
Pierre

--
Fastcode Project: http://www.fastcodeproject.org/






.