home *** CD-ROM | disk | FTP | other *** search
/ PC Media 4 / PC MEDIA CD04.iso / share / prog / memalloc / memalloc.doc < prev    next >
Encoding:
Text File  |  1994-07-20  |  1.6 KB  |  70 lines

  1. Memory manager with moveable blocks
  2. ===================================
  3. Written by Roger Moser, Switzerland
  4.  
  5.  
  6. Functions
  7. ---------
  8.  
  9. void mem_init(long bufsize);
  10.  
  11.     Allocate bufsize bytes for the memory manager.
  12.  
  13.         If bufsize is 0 then all available memory will be allocated.
  14.         If run under Windows bufsize should not be 0.
  15.  
  16.  
  17. int mem_alloc(mem_ptr* mempp, long n, long size);
  18.  
  19.     Allocate or reallocate a memory block.
  20.  
  21.     Parameters:
  22.         mempp   Pointer to the pointer defined in the application.
  23.                 The pointer must be initialized with NULL.
  24.         n       Number of elements.
  25.         size    Size of an element in bytes.
  26.  
  27.     Return value:
  28.         The function returns 1 if the allocation was successful
  29.         other it returns 0.
  30.  
  31.     Comments:
  32.         mem_alloc(mempp, 0, 0) is the same as mem_free(mempp).
  33.         If both n and size are 0 then mempp will be set to NULL.
  34.  
  35.  
  36. void mem_free(mem_ptr* mempp);
  37.  
  38.     Free a memory block.
  39.  
  40.  
  41. long mem_avail(void);
  42.  
  43.     Return available memory in bytes.
  44.  
  45.  
  46. void mem_exit(void);
  47.  
  48.     Close the memory manager.
  49.  
  50. int mem_check(void);
  51.  
  52.     Check the chain of memory control blocks.
  53.  
  54.     Return value:
  55.         This function returns 0 if everything is ok.
  56.  
  57.  
  58. Note
  59. ----
  60.  
  61. If you allocate a new memory block or increase the size of an existing
  62. memory block by calling mem_alloc() then some or all memory blocks may
  63. be moved. If a block is moved the pointer the that block is
  64. automatically updated.
  65.  
  66.  
  67. If you have any questions feel free to ask me via CompuServe.
  68.  
  69. Roger Moser (100111,762)
  70.