* 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:
florian 2005-06-04 10:53:38 +00:00
parent 7ba46ce6f0
commit 0d7aaab6b8
2 changed files with 4 additions and 1 deletions

View File

@ -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);

View File

@ -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 }