_heapmin, _bheapmin, _fheapmin, _nheapmin

shrink a heap to its smallest possible size

Synopsis:

#include <malloc.h>
int  _heapmin( void );
int _bheapmin( __segment seg );
int _fheapmin( void );
int _nheapmin( void );

Description:

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:

_heapmin()
Depends on data model of the program (see below)
_bheapmin()
Based heap specified by seg value; _NULLSEG specifies all based heaps
_fheapmin()
Far heap (outside the default data segment)
_nheapmin()
Near heap (inside the default data segment)

In a small data memory model, the _heapmin() function is equivalent to the _nheapmin() function; in a large data memory model, the _heapmin() function is equivalent to the _fheapmin() function. It is identical to the _heapshrink() function.

Returns:

These functions return zero if successful, and non-zero if some error occurred.

See also:

_heapchk(), _heapenable(), _heapgrow(), _heapset(), _heapshrink(), _heapwalk()

Examples:

#include <stdlib.h>
#include <malloc.h>

void main()
  {
    _heapmin();
    system( "cd /home/fred" );
  }

Classification:

WATCOM

Systems:

_heapmin()
All (except Netware, DOS/PM)
_bheapmin()
DOS/16, Windows, QNX/16, OS/2 1.x(all)
_fheapmin()
DOS/16, Windows, QNX/16, OS/2 1.x(all)
_nheapmin()
DOS, Windows, Win386, Win32, QNX, OS/2 1.x, OS/2 1.x(MT), OS/2-32