home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l350 / 3.ddi / EXAMPLES / WINDOWS / MEMAVAIL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-29  |  569 b   |  29 lines

  1. /* 
  2. MEMAVAIL.C -- illustrates Windows 3.0 grow limit
  3.  
  4. C:\DOSX386>run386 memavail
  5. Memory available: 2061312 bytes
  6.  
  7. C:\DOSX386>run386 -win30limit +300000h memavail
  8. Memory available: 3093504 bytes
  9. */ 
  10.  
  11. #include <stdlib.h> 
  12. #include <stdio.h> 
  13.  
  14. #define BLKSIZE     1024 
  15.  
  16. main() 
  17.     char *p; 
  18.     unsigned bytes=0;   // 32 bits 
  19.     while ((p = malloc(BLKSIZE)) != 0) 
  20.     { 
  21.         *p = 'x'; // touch  
  22.         p[BLKSIZE-1] = 'y'; 
  23.         bytes += BLKSIZE; 
  24.     } 
  25.     printf("Memory available: %u bytes\n", bytes); 
  26.     return 0; 
  27.