+ added writelns behind { DEBUG_TINY_HEAP} for tracing the tiny heap calls

git-svn-id: trunk@24518 -
This commit is contained in:
nickysn 2013-05-16 22:11:01 +00:00
parent 7f5aa5a441
commit 4fc5900c78

View File

@ -39,6 +39,9 @@
p, prev: PTinyHeapBlock;
AllocSize, RestSize: ptruint;
begin
{$ifdef DEBUG_TINY_HEAP}
Write('SysTinyGetMem(', Size, ')=');
{$endif DEBUG_TINY_HEAP}
AllocSize := align(size+sizeof(ptruint), sizeof(pointer));
p := TinyHeapBlocks;
@ -72,6 +75,9 @@
end
else
Result := nil;
{$ifdef DEBUG_TINY_HEAP}
Writeln(ptruint(Result));
{$endif DEBUG_TINY_HEAP}
end;
function TinyGetAlignedMem(Size, Alignment: ptruint): pointer;
@ -167,6 +173,9 @@
var
sz: ptruint;
begin
{$ifdef DEBUG_TINY_HEAP}
Writeln('SysTinyFreeMem(', ptruint(Addr), ')');
{$endif DEBUG_TINY_HEAP}
sz := Align(FindSize(addr)+SizeOf(ptruint), sizeof(pointer));
InternalTinyFreeMem(@pptruint(addr)[-1], sz);
@ -195,6 +204,9 @@
var
sz: ptruint;
begin
{$ifdef DEBUG_TINY_HEAP}
Write('SysTinyReAllocMem(', ptruint(p), ',', size, ')=');
{$endif DEBUG_TINY_HEAP}
result := AllocMem(size);
if result <> nil then
begin
@ -208,10 +220,16 @@
end;
SysTinyFreeMem(p);
p := result;
{$ifdef DEBUG_TINY_HEAP}
Writeln(ptruint(result));
{$endif DEBUG_TINY_HEAP}
end;
procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
begin
{$ifdef DEBUG_TINY_HEAP}
Writeln('RegisterTinyHeapBlock(', ptruint(AAddress), ',', ASize, ')');
{$endif DEBUG_TINY_HEAP}
if (ptruint(AAddress) and 1) = 0 then
begin
Inc(AAddress);