Globalmemorystatus, Win32 API function.

Source: Internet
Author: User

Reprinted:

Globalmemorystatus, Win32 API function.

This function is used to obtain available physical and virtual memory information. The function is defined:

 

Void globalmemorystatus
(
Lpmemorystatus lpbuffer
);

 

This function has no return value. The parameter is a pointer to the structure named memorystatus. The returned information of the function is stored in the memorystatus structure.

This function is used to replace the getfreespace function that supports 16-bit applications.

The application should call this function before applying for memory to prevent other programs from being affected.

The return value of this function is dynamic and may return the same value.

About the memorystatus structure:

Organization definition:
Typedef struct _ memorystatus

{// MST
DWORD dwlength; // sizeof (memorystatus)
DWORD dwmemoryload; // percent of memory in use
DWORD dwtotalphys; // bytes of physical memory
DWORD dwavailphys; // free physical memory bytes
DWORD dwtotalpagefile; // bytes of paging file
DWORD dwavailpagefile; // free bytes of paging file
DWORD dwtotalvirtual; // user bytes of address space
DWORD dwavailvirtual; // free user bytes

} Memorystatus, * lpmemorystatus;

 

Structure member description:
DwlengthThe size of the memorystatus structure, which is obtained by using the sizeof () function before calling the globalmemorystatus function,

The version used to check the structure of the function.

DwmemoryloadReturns a value ranging from 0 ~ Value between 100 to indicate the current system memory usage.

DwtotalphysReturns the total physical memory size, in bytes.

DwavailphysReturns the available physical memory in bytes.

DwtotalpagefileDisplays the number of bytes that can exist in the page file. Note that this value does not indicate the actual physical size of the page file on the disk.

DwavailpagefileReturns the size of Available page files, in bytes.

DwtotalvirtualReturns all available virtual address spaces in the user mode of the calling process, in bytes.

DwavailvirtualReturns the free virtual address space of the user mode part of the calling process, in bytes.

 

Memorystatus structure,
The structure is defined as follows:
Memorystatus struct
Dwlength DWORD; length of the current structure
Dwmemoryload DWORD; percentage of memory in use
Dwtotalphys DWORD; total physical memory
Dwavailphys DWORD; available physical memory
Dwtotalpagefile DWORD; Total swap file size
Dwavailpagefile DWORD; the size of the free part in the SWAp File
Dwtotalvirtual DWORD; available address space of the user
Dwavailvirtual DWORD; the current idle address space
Memorystatus ends

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/sunky/archive/2008/07/15/2654254.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.