Question

What win32 APIs are useful to code a tool as described here:

My goal is a tool that can be used to check/report if a specific part of a file is located/available in-memory (RAM) or in virtual memory (disk) at a moment ?

Was it helpful?

Solution

VirtualQuery QueryWorkingSetEx does that, specifically the Locked bit in PSAPI_WORKING_SET_EX_BLOCK. VirtualQuery as I've incorrectly pointed out initially merely lets you tell whether pages are committed and such, not whether they're actually in physical RAM. For Linux, it would be mincore, which simply returns a byte vector (LSB == 1 for in-core).

Note that the information you get is a snapshot, which means the information may in principle already be outdated at the time the function returns (much like GetCurrentProcessorNumber).
So, treat the information as a (probably more or less accurate, but unreliable) hint, not a guarantee.

OTHER TIPS

Doesn't exist, for a simple reason. The answer could change while the API function returns. (Also, the answer often is "yes and yes".)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top