Thread: Memory status

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    9

    Memory status

    I am trying to use the GlobalMemoryStatus() function to find out memory avilability in a PC.
    I am not having much success. Could anybody explain its usage with an example?
    Many thanks
    Bazz

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    PHP Code:
    #include <windows.h>
    #include <stdio.h>

    int main()
    {
        
    MEMORYSTATUS MemStat;

        
    GlobalMemoryStatus( &MemStat );

        
    printf"%ld %% of Memory in use.\n"MemStat.dwMemoryLoad );
        
    printf"\n" );
        
    printf"%ld bytes of physical memory.\n"MemStat.dwTotalPhys );
        
    printf"%ld bytes of physical memory available.\n"MemStat.dwAvailPhys );
        
    printf"\n" );
        
    printf"%ld bytes of pagefile memory.\n"MemStat.dwTotalPageFile );
        
    printf"%ld bytes of pagefile memory available.\n"MemStat.dwAvailPageFile );
        
    printf"Note that this number does not represent the actual physical size of the paging file on disk.\n" );
        
    printf"\n" );
        
    printf"%ld bytes of virtual memory.\n"MemStat.dwTotalVirtual );
        
    printf"%ld bytes of virtual memory available.\n"MemStat.dwAvailVirtual );
        
        return 
    0;

    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mutex and Shared Memory Segment Questions.
    By MadDog in forum Linux Programming
    Replies: 14
    Last Post: 06-20-2010, 04:04 AM
  2. tools for finding memory leaks
    By stanlvw in forum C++ Programming
    Replies: 4
    Last Post: 04-03-2009, 11:41 AM
  3. Problems with shared memory shmdt() shmctl()
    By Jcarroll in forum C Programming
    Replies: 1
    Last Post: 03-17-2009, 10:48 PM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  5. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 01:33 PM