Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_heapmin() minimize heap</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _heapmin()              Minimize Heap

 #include   <malloc.h>

 int _heapmin(void);

    The _heapmin() function frees all unused entries on the heap,
    minimizing the size of the heap. Under large data models,
    _heapmin() maps to _fheapmin(). In small data models, _heapmin()
    maps to _nheapmin().

    Returns:    0 if successful; -1 if not.

 Portability:   Not supported by the ANSI standard.

   -------------------------------- Example ---------------------------------

        This example adds memory to the heap, releases it, and compacts
        the heap again:

        #include <stdio.h>
        #include <conio.h>
        #include <process.h>
        #include <malloc.h>

        char TestString[] = {"TEST STRING"};

        void main()
        {

            printf("Starting....\n");

            _heapadd(TestString, sizeof(TestString));
            printf( "Have added the test string....\n" );

            free(TestString);
            printf("Have freed memory...\n" );

            _heapmin();
            printf("Have compacted heap....\n");
        }

See Also: _expand() free() _heapmin() malloc() realloc()

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