home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 375.lha / IncrStorageManager_v1.0 / Storage.mod < prev    next >
Text File  |  1990-05-02  |  781b  |  30 lines

  1. IMPLEMENTATION MODULE Storage;
  2.  
  3. FROM SYSTEM IMPORT ADDRESS, NULL;
  4. IMPORT Memory;
  5.  
  6. PROCEDURE ALLOCATE(VAR addr: ADDRESS; amount: LONGCARD);
  7.   (* allocate a portion of memory - return 0 if no memory available.
  8.  
  9.      addr: returns where the memory portion was allocated, word aligned.
  10.      amount: the number of bytes to allocate, will be a word multiple. *)
  11. BEGIN
  12.   addr := Memory.AllocMem(amount, Memory.MemReqSet{Memory.MemClear});
  13.  
  14.   IF addr = NULL
  15.   THEN
  16.     addr := NIL;
  17.   END;
  18. END ALLOCATE;
  19.  
  20. PROCEDURE DEALLOCATE(VAR addr: ADDRESS; amount: LONGCARD);
  21.   (* return a portion of memory to the heap.
  22.  
  23.      addr: the portion of memory returned by ALLOCATE.
  24.      amount: the size of the block given to ALLOCATE. *)
  25. BEGIN
  26.   Memory.FreeMem(addr, amount);
  27. END DEALLOCATE;
  28.  
  29. END Storage.
  30.