mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 04:33:51 +02:00
+ added writelns behind { DEBUG_TINY_HEAP} for tracing the tiny heap calls
git-svn-id: trunk@24518 -
This commit is contained in:
parent
7f5aa5a441
commit
4fc5900c78
@ -39,6 +39,9 @@
|
|||||||
p, prev: PTinyHeapBlock;
|
p, prev: PTinyHeapBlock;
|
||||||
AllocSize, RestSize: ptruint;
|
AllocSize, RestSize: ptruint;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef DEBUG_TINY_HEAP}
|
||||||
|
Write('SysTinyGetMem(', Size, ')=');
|
||||||
|
{$endif DEBUG_TINY_HEAP}
|
||||||
AllocSize := align(size+sizeof(ptruint), sizeof(pointer));
|
AllocSize := align(size+sizeof(ptruint), sizeof(pointer));
|
||||||
|
|
||||||
p := TinyHeapBlocks;
|
p := TinyHeapBlocks;
|
||||||
@ -72,6 +75,9 @@
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
{$ifdef DEBUG_TINY_HEAP}
|
||||||
|
Writeln(ptruint(Result));
|
||||||
|
{$endif DEBUG_TINY_HEAP}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TinyGetAlignedMem(Size, Alignment: ptruint): pointer;
|
function TinyGetAlignedMem(Size, Alignment: ptruint): pointer;
|
||||||
@ -167,6 +173,9 @@
|
|||||||
var
|
var
|
||||||
sz: ptruint;
|
sz: ptruint;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef DEBUG_TINY_HEAP}
|
||||||
|
Writeln('SysTinyFreeMem(', ptruint(Addr), ')');
|
||||||
|
{$endif DEBUG_TINY_HEAP}
|
||||||
sz := Align(FindSize(addr)+SizeOf(ptruint), sizeof(pointer));
|
sz := Align(FindSize(addr)+SizeOf(ptruint), sizeof(pointer));
|
||||||
|
|
||||||
InternalTinyFreeMem(@pptruint(addr)[-1], sz);
|
InternalTinyFreeMem(@pptruint(addr)[-1], sz);
|
||||||
@ -195,6 +204,9 @@
|
|||||||
var
|
var
|
||||||
sz: ptruint;
|
sz: ptruint;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef DEBUG_TINY_HEAP}
|
||||||
|
Write('SysTinyReAllocMem(', ptruint(p), ',', size, ')=');
|
||||||
|
{$endif DEBUG_TINY_HEAP}
|
||||||
result := AllocMem(size);
|
result := AllocMem(size);
|
||||||
if result <> nil then
|
if result <> nil then
|
||||||
begin
|
begin
|
||||||
@ -208,10 +220,16 @@
|
|||||||
end;
|
end;
|
||||||
SysTinyFreeMem(p);
|
SysTinyFreeMem(p);
|
||||||
p := result;
|
p := result;
|
||||||
|
{$ifdef DEBUG_TINY_HEAP}
|
||||||
|
Writeln(ptruint(result));
|
||||||
|
{$endif DEBUG_TINY_HEAP}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
|
procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
|
||||||
begin
|
begin
|
||||||
|
{$ifdef DEBUG_TINY_HEAP}
|
||||||
|
Writeln('RegisterTinyHeapBlock(', ptruint(AAddress), ',', ASize, ')');
|
||||||
|
{$endif DEBUG_TINY_HEAP}
|
||||||
if (ptruint(AAddress) and 1) = 0 then
|
if (ptruint(AAddress) and 1) = 0 then
|
||||||
begin
|
begin
|
||||||
Inc(AAddress);
|
Inc(AAddress);
|
||||||
|
Loading…
Reference in New Issue
Block a user