[fpc-devel]Bad heap manager?

Peter Vreman peter at freepascal.org
Thu Feb 28 09:35:15 CET 2002


> On Thu, 28 Feb 2002, Jonas Maebe wrote:
> }
> }Concatenating when allocating instead of when freeing would help here, but
> }it would probably slow down the heap manager in cases where this wouldn't
> }be necessary otherwise.
> 
> I don't actually know how FPC's heap manager works but once when I wrote a
> library for similar purpose (a static memory pool) I chose to concatenate
> when allocating and it effectively added no overhead at all (one CPU cycle
> per memory block, to be precise). Of cource, I had to manage no more than
> 1 meg or so with few hundred blocks and thus I could use simple
> incremental search when allocating. If FPC uses a smarter way, it wouldn't
> help you much.
> 
> BTW, coulnd't you add a Defragment procedure into System unit? Slow or
> not, but it would be useful when program encounters hopeless heap
> fragmentation.

A defragmentation is not possible since a program can have pointers pointing to the heap
that would also need to be updated.







More information about the fpc-devel mailing list