home *** CD-ROM | disk | FTP | other *** search
- Memory manager with moveable blocks
- ===================================
- Written by Roger Moser, Switzerland
-
-
- Functions
- ---------
-
- void mem_init(long bufsize);
-
- Allocate bufsize bytes for the memory manager.
-
- If bufsize is 0 then all available memory will be allocated.
- If run under Windows bufsize should not be 0.
-
-
- int mem_alloc(mem_ptr* mempp, long n, long size);
-
- Allocate or reallocate a memory block.
-
- Parameters:
- mempp Pointer to the pointer defined in the application.
- The pointer must be initialized with NULL.
- n Number of elements.
- size Size of an element in bytes.
-
- Return value:
- The function returns 1 if the allocation was successful
- other it returns 0.
-
- Comments:
- mem_alloc(mempp, 0, 0) is the same as mem_free(mempp).
- If both n and size are 0 then mempp will be set to NULL.
-
-
- void mem_free(mem_ptr* mempp);
-
- Free a memory block.
-
-
- long mem_avail(void);
-
- Return available memory in bytes.
-
-
- void mem_exit(void);
-
- Close the memory manager.
-
- int mem_check(void);
-
- Check the chain of memory control blocks.
-
- Return value:
- This function returns 0 if everything is ok.
-
-
- Note
- ----
-
- If you allocate a new memory block or increase the size of an existing
- memory block by calling mem_alloc() then some or all memory blocks may
- be moved. If a block is moved the pointer the that block is
- automatically updated.
-
-
- If you have any questions feel free to ask me via CompuServe.
-
- Roger Moser (100111,762)