home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / C / ResourceTracking.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-30  |  1.1 KB  |  42 lines

  1. /* Resource Tracking
  2. ** -----------------
  3. ** This program tests the resource tracking of GMS.  It will attempt to
  4. ** allocate 100 sets of 10k and then exit without freeing them.  GMS will
  5. ** respond with a warning and will free all the memory that was allocated.
  6. **
  7. */
  8.  
  9. #include <proto/exec.h>
  10. #include <proto/games.h>
  11. #include <stdio.h>
  12.       
  13. struct GMSBase *GMSBase;
  14.  
  15. struct Keys GameKeys;
  16.  
  17. void main(void)
  18. {
  19.    char key;
  20.    int i;
  21.  
  22.    GMSBase = (struct GMSBase *) OpenLibrary("games.library", 0);
  23.  
  24.    printf("Resource Tracking\n");
  25.    printf("-----------------\n");
  26.    printf("This program tests the resource tracking of GMS.  It will attempt to\n");
  27.    printf("allocate 100 blocks of 10k and then exit without freeing them.  GMS will\n");
  28.    printf("respond with a warning and will free all the memory that was allocated.\n");
  29.    printf("\nPress the return key to start.\n\n");
  30.  
  31.    scanf("%c",&key);
  32.  
  33.    printf("Attempting to allocate 100 blocks of 10k...\n\n");
  34.  
  35.    for (i=0; i<100; i++)
  36.      AllocMemBlock(10000,MEM_ANY);
  37.  
  38.    printf("Closing down...\n\n");
  39.  
  40.    CloseLibrary((struct Library *)GMSBase);
  41. }
  42.