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>
    size_t _memmax( void );

Description:
    The _memmax function returns the size of the largest contiguous block of
    memory available for dynamic memory allocation in the near heap (the
    default data segment).  In the tiny, small and medium memory models, the
    default data segment is only extended as needed to satisfy requests for
    memory allocation.  Therefore, you will need to call  _nheapgrow in
    these memory models before calling _memmax in order to get a meaningful
    result.


Returns:
    The _memmax function returns the size of the largest contiguous block of
    memory available for dynamic memory allocation in the near heap.  If 0
    is returned, then there is no more memory available in the near heap.

See Also:
    calloc Functions, _freect, _memavl, _heapgrow Functions, malloc Functions

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

    void main()
      {
        char *p;
        size_t size;

        size = _memmax();
        printf( "Maximum memory available is %u\n", size );
        _nheapgrow();
        size = _memmax();
        printf( "Maximum memory available is %u\n", size );
        p = (char *) _nmalloc( size );
        size = _memmax();
        printf( "Maximum memory available is %u\n", size );
      }

    produces the following:

    Maximum memory available is 0
    Maximum memory available is 62700
    Maximum memory available is 0

Classification:
    WATCOM

Systems:
    All

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