return the size of the largest contiguous block of memory available
#include <malloc.h> size_t _memmax( void );
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).
the size of the largest contiguous block of memory available for dynamic memory allocation in the near heap. If this is 0, then there is no more memory available in the near heap.
calloc(), _freect(), _memavl(), _heapgrow(), malloc()
#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 output:
Maximum memory available is 0 Maximum memory available is 62700 Maximum memory available is 0
WATCOM
All (except Netware, DOS/PM)