mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 03:39:28 +02:00
* keep same fixed block, also if we resize to a smaller size.
git-svn-id: trunk@4313 -
This commit is contained in:
parent
dc9c5905bc
commit
b3732f7215
@ -1156,10 +1156,13 @@ begin
|
||||
begin
|
||||
currsize := chunksize and fixedsizemask;
|
||||
|
||||
{ first check if the size fits in the fixed block range to prevent
|
||||
"truncating" the size by the fixedsizemask }
|
||||
if (size <= (maxblocksize - sizeof(tmemchunk_fixed_hdr))) and
|
||||
((size+sizeof(tmemchunk_fixed_hdr)+(blocksize-1)) and sizemask =currsize ) then
|
||||
{ 1. Resizing to smaller sizes will never allocate a new block. We just keep the current block. This
|
||||
is needed for the expectations that resizing to a small block will not move the contents of
|
||||
a memory block
|
||||
2. For resizing to greater size first check if the size fits in the fixed block range to prevent
|
||||
"truncating" the size by the fixedsizemask }
|
||||
if ((size <= (maxblocksize - sizeof(tmemchunk_fixed_hdr))) and
|
||||
((size+sizeof(tmemchunk_fixed_hdr)+(blocksize-1)) and sizemask<=currsize )) then
|
||||
begin
|
||||
systryresizemem:=true;
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user