How To Limit Virtual Memory for a Win32s Application
ID: Q147434
|
The information in this article applies to:
-
Microsoft Win32s versions 1.30, 1.30a, 1.30c
SUMMARY
It is possible to limit the amount of virtual memory that a 32-bit
application running under Win32s version 1.3c can use. This could be a
potential requirement for some 32-bit applications that do not want to swap
data out to the pagefile at all.
MORE INFORMATION
In your Win32s application, you can call VirtualAlloc() to allocate all the
required memory at one time and then use only this memory.
To do this, you need to adjust the working set size of your 32-bit process.
Win32s partially supports the Win32 functions GetProcessWorkingSet() and
SetProcessWorkingSet(). Although the hProcess and dwMinimumWorkingSetSize
parameters are ignored, you can call SetProcessWorkingSet(), and set the
dwMaximumWorkingSetSize to the total number of pages that your 32-bit
application needs to lock in memory. This number is system wide in the
Windows 3.x environment; it is not a per-process number as in Windows NT.
Next, you need to call VirtualLock() to lock the allocated pages. This way
the memory will not be swapped out. Note that VirtualLock() is supported in
Win32s even though the Win32 documentation says otherwise. It is also
important to note that unlike in Win32, the dwMaximumWorkingSetSize
parameter of SetProcessWorkingSet() function does not limit the working set
size of Win32s applications. It only sets the limit on how many pages can
be locked in memory (by calling VirtualLock()).
Additional query words:
kbinf noswap pagefile virtual memory
Keywords : kbWin32s
Version : 1.30 1.30a 1.30c
Platform : WINDOWS
Issue type :