home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l350 / 3.ddi / EXAMPLES / C / FREEMEM.C next >
Encoding:
C/C++ Source or Header  |  1993-01-04  |  950 b   |  32 lines

  1. //
  2. // FREEMEM.C -- Print out available memory
  3. //
  4. #include <stdio.h>
  5. #include <pharlap.h>
  6. int main()
  7. {
  8.     CONFIG_INF config;
  9.     UCHAR buf[256];
  10.     VM_STATS memstats;
  11.  
  12. //
  13. // The most accurate number is the largest available virtual memory
  14. // block (virtual == physical when not in a virtual memory environment).
  15. // This number does NOT include any free memory in the C run-time
  16. // memory allocator heap, a number that can be obtained (if at all)
  17. // only in a compiler-specific manner.
  18. //
  19. // Note that under Windows 3.x enhanced mode this number is not very 
  20. // accurate, because the Windows DPMI services report inaccurate numbers.
  21. // 
  22.     _dx_config_inf(&config, buf);
  23.     _dx_vm_stats(&memstats, FALSE);
  24.     printf("Largest available memory block is %d bytes\n",
  25.                     memstats.vm_maxblk * 4096);
  26.     if (config.c_windowsf && config.c_winenhf)
  27.         printf("(Windows enhanced mode:  available memory \
  28. count is inaccurate)\n");
  29.  
  30.     return 0;
  31. }
  32.