mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 16:49:00 +02:00
* patch from Ales Katona making the memory manager more
smart when releasing memory chunks back to the OS git-svn-id: trunk@190 -
This commit is contained in:
parent
7ba46ce6f0
commit
0d7aaab6b8
@ -642,7 +642,8 @@ procedure append_to_oslist(poc: poschunk);
|
||||
begin
|
||||
{ decide whether to free block or add to list }
|
||||
{$ifdef HAS_SYSOSFREE}
|
||||
if freeoslistcount >= 3 then
|
||||
if (freeoslistcount >= MaxKeptOSChunks)
|
||||
or (poc^.size > growheapsize2) then
|
||||
begin
|
||||
dec(internal_status.currheapsize, poc^.size);
|
||||
SysOSFree(poc, poc^.size);
|
||||
|
@ -76,6 +76,8 @@ procedure SetMemoryMutexManager(var MutexMgr: TMemoryMutexManager);
|
||||
|
||||
{ Variables }
|
||||
const
|
||||
MaxKeptOSChunks: DWord = 3; { if more than MaxKeptOSChunks are free, the heap manager will release
|
||||
chunks back to the OS }
|
||||
growheapsizesmall : ptrint=32*1024; { fixed-size small blocks will grow with 32k }
|
||||
growheapsize1 : ptrint=256*1024; { < 256k will grow with 256k }
|
||||
growheapsize2 : ptrint=1024*1024; { > 256k will grow with 1m }
|
||||
|
Loading…
Reference in New Issue
Block a user