|
@@ -60,7 +60,7 @@
|
|
|
|
|
|
TinyHeapAllocGranularity = sizeof(TTinyHeapBlock);
|
|
|
|
|
|
- procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint); forward;
|
|
|
+ procedure RegisterTinyHeapBlock(AAddress: Pointer; ASize:{$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif}); forward;
|
|
|
|
|
|
function EncodeTinyHeapFreeBlockSize(Size: PtrUInt): TTinyHeapFreeBlockSize; inline;
|
|
|
begin
|
|
@@ -148,12 +148,14 @@
|
|
|
p:=SysOSAlloc(AllocSize);
|
|
|
if assigned(p) then
|
|
|
begin
|
|
|
+ { This needs toi be fixed because
|
|
|
+ HeapEnd and HeapSize are not updated correctly
|
|
|
if p > HeapPtr then
|
|
|
begin
|
|
|
prev:=HeapPtr;
|
|
|
HeapPtr:=p;
|
|
|
end
|
|
|
- else
|
|
|
+ else }
|
|
|
begin
|
|
|
RegisterTinyHeapBlock(p,AllocSize);
|
|
|
{ Recursive call }
|
|
@@ -512,7 +514,7 @@
|
|
|
{ Strongly simplified version of RegisterTinyHeapBlock, which can be used when
|
|
|
the heap is only a single contiguous memory block. If you want to add
|
|
|
multiple blocks to the heap, you should use RegisterTinyHeapBlock instead. }
|
|
|
- procedure RegisterTinyHeapBlock_Simple(AAddress: Pointer; ASize: PtrUInt);
|
|
|
+ procedure RegisterTinyHeapBlock_Simple(AAddress: Pointer; ASize:{$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif});
|
|
|
begin
|
|
|
{$ifdef DEBUG_TINY_HEAP}
|
|
|
Writeln('RegisterTinyHeapBlock_Simple(', HexStr(AAddress), ',', ASize, ')');
|
|
@@ -528,7 +530,7 @@
|
|
|
{ Strongly simplified version of RegisterTinyHeapBlock, which can be used when
|
|
|
the heap is only a single contiguous memory block and the address and size
|
|
|
are already aligned on a TinyHeapAllocGranularity boundary. }
|
|
|
- procedure RegisterTinyHeapBlock_Simple_Prealigned(AAddress: Pointer; ASize: PtrUInt);
|
|
|
+ procedure RegisterTinyHeapBlock_Simple_Prealigned(AAddress: Pointer; ASize: {$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif});
|
|
|
begin
|
|
|
{$ifdef DEBUG_TINY_HEAP}
|
|
|
Writeln('RegisterTinyHeapBlock_Simple_Prealigned(', HexStr(AAddress), ',', ASize, ')');
|
|
@@ -540,7 +542,7 @@
|
|
|
HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
|
|
|
end;
|
|
|
|
|
|
- procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
|
|
|
+ procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: {$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif});
|
|
|
var
|
|
|
alignment_inc: smallint;
|
|
|
p: PTinyHeapBlock;
|