After you have optimized your working set and know approximately what it is, you may have to alter your application's requested working set size for efficiency. Keep in mind that setting an unreasonable working set size can degrade performance system-wide.
To find out the requested minimum and maximum sizes of the working set for your application, call the GetProcessWorkingSetSize function. The virtual memory manager attempts to keep enough memory for the minimum working set resident when the process is active, but keeps no more than the maximum size.
You can also set these values using the SetProcessWorkingSetSize function. Setting these values is not a guarantee that the memory will be reserved or resident.
Calling VirtualUnlock on a range of memory that is not locked releases pages from the working set.