[fpc-devel] Re: Compiler bottlenecks

Florian Klaempfl florian at freepascal.org
Thu Jul 15 11:43:16 CEST 2010


Mattias Gärtner schrieb:
> Zitat von Jonas Maebe <jonas.maebe at elis.ugent.be>:
> 
>> Michael Schnell wrote on Thu, 15 Jul 2010:
>>
>>> Did somebody take a look at FastMM for Delphi ? (
>>> http://sourceforge.net/projects/fastmm/ )
>>>
>>> Same seems to use a nice paradigm doing the Memory management for
>>> threaded applications.
>>
>> Then please explain that paradigm, since apparently you already looked
>> at it.
>>
>> In return, I will explain the FPC heap manager's paradigm: per thread,
>> there is a separate heap manager so that in most cases no
>> synchronisation is required. Only if memory is allocated in one thread
>> and freed in another, then it will be added to a global locked
>> structure. When a thread runs out of memory in its pools, it will
>> first check this global (synchronised) structure before asking for
>> more memory from the OS.
> 
> Does that mean, if I let a worker thread create strings, pass them to
> the main thread, free the worker thread and unreference the strings in
> the main thread the global structure will grow and grow?

No, because the worker thread looks into the global structure when it
runs out of "local" space.



More information about the fpc-devel mailing list