[fpc-devel] Need heap manager -gv explanation [tests]
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Apr 29 12:51:37 CEST 2014
On Tue, 29 Apr 2014 12:13:48 +0200
Petr Kristan <petr.kristan at epos.cz> wrote:
>[...]
> Is possible to tune this space behind the blocks?
The space is bad for the processor's caches.
You only need the space behind when you want to grow big chunks in
many small steps. Since this does not happen often it is
better to change the few places in your code than the whole heap
manager.
Just allocate somewhat more than you need.
For example:
if NeededSize>CurrentSize then
begin
CurrentSize:=Max(NeededSize,CurrentSize+CurrentSize div 2);
ReAllocMem(p1, CurrentSize);
end;
Mattias
More information about the fpc-devel
mailing list