mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-11 10:10:40 +01:00
+ optimization in SysTinyReAllocMem for the case of shrinking a memory block
git-svn-id: trunk@28714 -
This commit is contained in:
parent
a0d03d5f33
commit
e4f3f33692
@ -288,6 +288,12 @@
|
||||
if size > oldsize then
|
||||
FillChar((TTinyHeapPointerArithmeticType(p)+oldsize)^, size-oldsize, 0);
|
||||
end
|
||||
else if OldAllocSize > NewAllocSize then
|
||||
begin
|
||||
{ we're decreasing the memory block size, so we can just free the remaining memory at the end }
|
||||
PTinyHeapMemBlockSize(p)[-1] := size;
|
||||
InternalTinyFreeMem(Pointer(TTinyHeapPointerArithmeticType(p)+(NewAllocSize-PtrUInt(SizeOf(TTinyHeapMemBlockSize)))), OldAllocSize-NewAllocSize);
|
||||
end
|
||||
else
|
||||
begin
|
||||
result := AllocMem(size);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user