Memory Requirements for a Win32 App vs. the Win16 Version

ID: Q117892

1.10 1.15 1.20 4.00 | 3.10 3.50 3.51 4.00

WINDOWS             | WINDOWS NT
kbprg

The information in this article applies to:

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.

You can use WMem to determine the address space used, the number of physical pages of RAM used, and to get an estimate of the working set. On a machine that has enough RAM to load the whole application without swapping, run only Program Manager and WMem. Use SHIFT+double-click in WMem and write down the available physical memory. Activate the application and use SHIFT+double-click again. The difference between the available physical memory before and after activating the application is a rough estimate of the working set. Test your application further and see how the working set changes during execution.

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 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.

KBCategory: kbprg KBSubcategory: BseMm Additional reference words: 1.10 1.20 3.10 3.50 4.00 95 ProgMan

Keywords          : kbAPI kbKernBase kbGrpKernBase 
Version           : 1.10 1.15 1.20 4.00 | 3.10 3.50
Platform          : NT WINDOWS

Last Reviewed: December 22, 1996