Browse Source

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

git-svn-id: trunk@24518 -
nickysn 12 years ago
parent
commit
4fc5900c78
1 changed files with 18 additions and 0 deletions
  1. 18 0
      rtl/inc/tinyheap.inc

+ 18 - 0
rtl/inc/tinyheap.inc

@@ -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);