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 Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <malloc.h>
    void  _heapgrow( void );
    void _nheapgrow( void );
    void _fheapgrow( void );

Description:
    The  _nheapgrow function attempts to grow the near heap to the maximum
    size of 64K.  You will want to do this in the small data models if you
    are using both  malloc and  _fmalloc or  halloc.  Once a call to
     _fmalloc or  halloc has been made, you may not be able to allocate any
    memory with  malloc unless space has been reserved for the near heap
    using either  malloc,  sbrk or  _nheapgrow.

    The  _fheapgrow function doesn't do anything to the heap because the far
    heap will be extended automatically when needed.  If the current far
    heap cannot be extended, then another far heap will be started.

    In a small data memory model, the _heapgrow function is equivalent to
    the  _nheapgrow function; in a large data memory model, the _heapgrow
    function is equivalent to the  _fheapgrow function.

Returns:
    These functions do not return a value.

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

    void main()
      {
        char *p, *fmt_string;
        fmt_string = "Amount of memory available is %u\n";
        printf( fmt_string, _memavl() );
        _nheapgrow();
        printf( fmt_string, _memavl() );
        p = (char *) malloc( 2000 );
        printf( fmt_string, _memavl() );
      }

    produces the following:

    Amount of memory available is 0
    Amount of memory available is 62732
    Amount of memory available is 60730

Classification:
    WATCOM

Systems:
     _heapgrow - All

    _fheapgrow - DOS/16, Windows, QNX/16, OS/2 1.x(all)
    _nheapgrow - DOS, Windows, Win386, Win32, QNX, OS/2 1.x, OS/2 1.x(MT),
    OS/2-32

See Also:
    _heapchk, _heapenable, _heapmin, _heapset, _heapshrink, _heapwalk

See Also: _heapenable

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