How HEAPSIZE/STACKSIZE Commit > Reserve Affects Execution (89296)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows NT 3.1
    • the operating system: Microsoft Windows NT 3.5
    • the operating system: Microsoft Windows NT 3.51
    • Microsoft Windows 95

This article was previously published under Q89296

SUMMARY

The syntax for the module-definition statements HEAPSIZE and STACKSIZE is as follows
   HEAPSIZE  [reserve] [,commit]
   STACKSIZE [reserve] [,commit]
				
The remarks for HEAPSIZE and STACKSIZE on page 62 of the "Tools User's Guide" manual that comes with the Win32 SDK state the following:
   When commit is less than reserve, memory demands are reduced but
   execution time is slower.
				
By default, commit is less than reserve.

The reason that execution time is slower (and it is actually only fractionally slower), is that the system sets up guard pages and could have to process guard page faults.

MORE INFORMATION

If the committed memory is less than the reserved memory, the system sets up guard page(s) around the heap or stack. When the heap or stack grows big enough, the guard pages start accessing outside the committed area. This causes a guard page fault, which tells the system to map in another page. The application continues to run as if you had originally had the new page committed.

If the committed memory is greater than the reserve, no guard pages are created and the program faults if it goes outside the committed memory area.

Experimenting with the commit versus reserve numbers may result in a combination that would produce noticeable results, but for most applications, this difference is probably not noticeable. The potential benefits do not warrant significant experimentation.

Modification Type:MajorLast Reviewed:3/29/2004
Keywords:KB89296