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 <stdlib.h>  For ANSI compatibility (free only)
    #include <malloc.h>  Required for other function prototypes
    void free( void *ptr );
    void _bfree( __segment seg, void __based(void) *ptr );
    void _ffree( void __far  *ptr );
    void _nfree( void __near *ptr );

Description:
    When the value of the argument ptr is NULL, the  free function does
    nothing; otherwise, the  free function deallocates the memory block
    located by the argument ptr which points to a memory block previously
    allocated through a call to the appropriate version of  calloc,  malloc
    or  realloc.  After the call, the freed block is available for
    allocation.

    Each function deallocates memory from a particular heap, as listed
    below:

    free
        Depends on data model of the program

    _bfree
        Based heap specified by seg value

    _ffree
        Far heap (outside the default data segment)

    _nfree
        Near heap (inside the default data segment)

    In a large data memory model, the  free function is equivalent to the
     _ffree function; in a small data memory model, the  free function is
    equivalent to the  _nfree function.

Returns:
    The  free functions return no value.

See Also:
    calloc Functions Functions, _expand Functions Functions, halloc, hfree, malloc Functions Functions,
    _msize Functions Functions, realloc Functions Functions, sbrk

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

    void main()
      {
        char *buffer;

        buffer = (char *)malloc( 80 );
        if( buffer == NULL ) {
          printf( "Unable to allocate memory\n" );
        } else {

          /* rest of code goes here */

          free( buffer );  /* deallocate buffer */
        }
      }

Classification:
    free is ANSI; _bfree, _ffree, and _nfree are not ANSI

Systems:
     free - All

    _bfree - DOS/16, Win/16, QNX/16, OS/2 1.x(all)
    _ffree - DOS/16, Win/16, QNX/16, OS/2 1.x(all)
    _nfree - 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