home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / memory / heapdbg / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-12  |  1.1 KB  |  42 lines

  1. /*********************************MAIN.C*****************************************/
  2. /*
  3.  * Author:       Mark Nelson
  4.  *
  5.  * Date:         October 28, 1989
  6.  *
  7.  * Description:  This is the main() module used to test the heap
  8.  *               debugger routines.  It does a few different
  9.  *               things that should be detected by the debugger
  10.  *               routines.
  11.  */
  12.  
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include "heap.h"
  16.  
  17. void main( void )
  18. {
  19.     char *test_guy_1;
  20.     char *test_guy_2;
  21.     char *test_guy_3;
  22.     char *maverick_pointer;
  23.  
  24.     test_guy_1 = malloc( 1000 );
  25.     test_guy_2 = malloc( 2000 );
  26. /*
  27.  * This call to strdup creates a maverick pointer that I should detect
  28.  * next time I get into my debugger routines.
  29.  */
  30.     maverick_pointer = strdup( "This is a test" );
  31.     test_guy_3 = malloc( 3000 );
  32. /*
  33.  *  Here I write one byte past my allocated area.  This should create a
  34.  *  picket error.
  35.  */
  36.     test_guy_2[ 2000 ] = 'X';
  37.     free( test_guy_1 );
  38.     free( maverick_pointer );
  39.     free( test_guy_2 );
  40.     free( test_guy_3 );
  41. }
  42.