home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / oberon / jacob-v0.1 / jacob-v0 / jacob / lib / Storage.ob2 < prev    next >
Encoding:
Text File  |  1996-04-04  |  1.2 KB  |  45 lines

  1. MODULE Storage EXTERNAL [""];
  2.  
  3. TYPE tHeapInfo* = RECORD
  4.       Start-          ,          (* start address of the heap  *)
  5.       End-            ,          (* end address of the heap    *)
  6.       TotalBytes-     ,          (* total size of the heap     *)
  7.       TotalFreeBytes- ,          (* sum of all free blocks     *)
  8.       MaxFreeBytes-   ,          (* size of largest free block *)
  9.       NofFreeBlocks-  : LONGINT; (* number of free block       *)
  10.      END;
  11.  
  12. tAllocFailHandler* = PROCEDURE(size,nofAttempts:LONGINT);
  13. (*
  14.  * An allocation request of 'size' bytes has failed for
  15.  * 'nofAttempts' times (=0 --> first time).
  16.  *)
  17.  
  18. PROCEDURE SetAllocFailHandler*(proc:tAllocFailHandler):tAllocFailHandler; 
  19. (*
  20.  * Sets the allocation fail handler to 'proc' and returns the old handler.
  21.  *)
  22.  
  23. PROCEDURE DumpHeap*; 
  24. (*
  25.  * Writes a detailed list of all heap blocks (free and allocated) to stdout.
  26.  *)
  27.  
  28. PROCEDURE GetInfo*(VAR inf:tHeapInfo); 
  29. (*
  30.  * Yields information about the current heap status.
  31.  *)
  32.  
  33. PROCEDURE ChangeHeapSize*(change:LONGINT):LONGINT; 
  34. (*
  35.  * Changes the size of the heap by 'change' bytes.
  36.  * Returns the number of bytes of the performed change.
  37.  *)
  38.  
  39. PROCEDURE GC*; 
  40. (*
  41.  * Performs a garbage collection.
  42.  *)
  43.  
  44. END Storage.
  45.