When an application is minimized, memory
one allocates may be paged out depending on whether it is allocated on
the stack or heap. One way to ensure that the data is not paged out is
to allocate any buffer used by your application as follows.
#define BUFSIZE 1024
char *Buffer;
BOOL Ret;
if ((Buffer=(char *)VirtualAlloc(NULL, BUFSIZE, MEM_COMMIT, PAGE_READWRITE)) == NULL)
{
//Do error handling
}
if (!VirtualLock(Buffer, BUFSIZE))
{
VirtualFree(....)
//Do error handling
}
|