shrink a heap to its smallest possible size
#include <malloc.h> int _heapmin( void ); int _bheapmin( __segment seg ); int _fheapmin( void ); int _nheapmin( void );
The _heapmin() functions attempt to shrink the specified heap to its smallest possible size by returning all free entries at the end of the heap back to the system. This can be used to free up as much memory as possible before using the system() function or one of the spawn... functions.
The various _heapmin() functions shrink the following heaps:
In a small data memory model, _heapmin() is equivalent to _nheapmin(); in a large data memory model, _heapmin() is equivalent to _fheapmin(). It's identical to _heapshrink().
Zero if successful, and nonzero if some error occurred.
#include <stdlib.h> #include <malloc.h> void main() { _heapmin(); system( "cd /home/fred" ); }
WATCOM
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
_heapchk(), _heapenable(), _heapgrow(), _heapset(), _heapshrink(), _heapwalk()