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 <dos.h>
    unsigned _dos_freemem( unsigned segment );

Description:
    The _dos_freemem function uses system call 0x49 to release memory that
    was previously allocated by  _dos_allocmem.  The value contained in
    segment is the one returned by a previous call to  _dos_allocmem.

Returns:
    The _dos_freemem function returns zero if successful.  Otherwise, it
    returns an MS-DOS error code and sets  errno to  ENOMEM indicating a bad
    segment value or DOS memory has been corrupted.

See Also:
    _dos_allocmem, _dos_setblock, free Functions, hfree

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

    void main()
      {
        unsigned short segment;

        /* Try to allocate 100 paragraphs, then free them */
        if( _dos_allocmem( 100, &segment ) != 0 ) {
          printf( "_dos_allocmem failed\n" );
          printf( "Only %u paragraphs available\n",
                   segment );
        } else {
          printf( "_dos_allocmem succeeded\n" );
          if( _dos_freemem( segment ) != 0 ) {
            printf( "_dos_freemem failed\n" );
          } else {
            printf( "_dos_freemem succeeded\n" );
          }
        }
      }

Classification:
    DOS

Systems:
    DOS, OS/2 1.x(all), OS/2 2.x, NT, DOS/PM

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