[fpc-pascal] Question on how to avoid memory trouble

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Feb 13 13:20:01 CET 2007


On 13 feb 2007, at 13:12, Helmut Hartl wrote:

>> Exactly, and cmpxchg etc. are really expensive too. Since
>> the original FPC heap uses already several pools, it should
>> be easily possible to make it scale better in multi threaded
>> applications.
>
> Fine that sounds really nice - Do you already have a idea what
> is not optimal and can be enhanced ?

The default memory manager is always entirely locked, while  
differently sized blocks are allocated from different pools. So it  
should be possible to lock only one pool per allocation.  
Additionally, getting a block from a pool may even be possibly using  
a few atomic operations rather than by acquiring a lock.

See rtl/inc/heap.inc


Jonas



More information about the fpc-pascal mailing list