Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <malloc.h>
    int  _heapshrink( void );
    int _bheapshrink( __segment seg );
    int _fheapshrink( void );
    int _nheapshrink( void );

Description:
    The  _heapshrink functions attempt to shrink the 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  _heapshrink functions shrink the following heaps:

    _heapshrink
        Depends on data model of the program

    _bheapshrink
        Based heap specified by seg value;  _NULLSEG specifies all based
        heaps

    _fheapshrink
        Far heap (outside the default data segment)

    _nheapshrink
        Near heap (inside the default data segment)

    In a small data memory model, the  _heapshrink function is equivalent to
    the  _nheapshrink function; in a large data memory model, the
     _heapshrink function is equivalent to the  _fheapshrink function.  It
    is identical to the  _heapmin function.

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

See Also:
    _heapchk Functions, _heapenable, _heapgrow Functions, _heapmin Functions, _heapset Functions, _heapwalk Functions

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

    void main()
      {
        _heapshrink();
        system( "chdir c:\\watcomc" );
      }

    Note the use of two adjacent backslash characters (\) within
    character-string constants to signify a single backslash.

Classification:
    WATCOM

Systems:
     _heapshrink - All

    _bheapshrink - DOS/16, Win/16, QNX/16, OS/2 1.x(all)
    _fheapshrink - DOS/16, Win/16, QNX/16, OS/2 1.x(all)
    _nheapshrink - DOS, Win, QNX, OS/2 1.x, OS/2 1.x(MT), OS/2 2.x, NT

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson