Microsoft KB Archive/117892

{|
 * width="100%"|

INFO: Memory Requirements for a Win32 App vs. the Win16 Version

 * }

Q117892

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows NT Server versions 3.1, 3.5, 3.51, 4.0
 * Microsoft Windows NT Workstation versions 3.1, 3.5, 3.51, 4.0
 * Microsoft Windows 95
 * Microsoft Win32s versions 1.1, 1.15, 1.2
 * the operating system: Microsoft Windows 2000

-

SUMMARY
A Win32 port of a Windows-based application generally requires more virtual memory than the original Windows-based application. However, it is possible for the Win32 version of the application to have a smaller working set. The working set is the certain number of pages that the virtual memory manager must keep in memory for a process to execute efficiently. If you lower the working set of an application, it will use less RAM.

MORE INFORMATION
It can appear that the Win32-based version of an application running on Win32s requires more RAM than the Windows-based version of the application running on the same machine. This is because segments of a Windows-based application are loaded only as they are referenced, while the address space is reserved for the Win32-based application and its DLLs (dynamic-link libraries) at program load. Therefore, the memory count that is displayed by many "About" boxes is misleading: for the Windows-based application, the free memory reported is reduced by the number of segments actually loaded; for the Win32-based application, the free memory reported is reduced by the total address space required. However, this free memory represents only the virtual address space that all applications share, not the amount of RAM actually used.

The working set of a Win32-based application can be decreased 30 percent or more with the use of the Working Set Tuner, included in the Platform Win32 SDK. However, a Win32-based application may fail to load on Win32s even if its working set is significantly smaller than the free RAM (for example, 100K working set versus 1 megabyte free RAM). The entire application, DLLs included, must be mapped into the virtual address space.

The virtual memory size is set by the system at boot time, based on several factors. RAM is one factor, free disk space is another. The system must be able to allocate enough space for the swap file on disk. Windows, by default, allows the size of the swap file to be a maximum of 4 times larger than available RAM. This constant (4) can be modified by setting PageOverCommit in the 386enh section of the SYSTEM.INI file. Valid settings are between 1 and 20. Setting PageOverCommit to a value larger than 4 will result in less efficient usage of resources and slower execution, but it will allow you to run applications that otherwise are not able to run.

Additional query words: 1.10 1.20 3.10 3.50 ProgMan

Keywords : kbAPI kbKernBase kbMemory kbOSWin2000 kbDSupport kbGrpDSKernBase

Issue type : kbinfo

Technology : kbAudDeveloper kbWin32sSearch kbWin32API