How HEAPSIZE/STACKSIZE Commit > Reserve Affects Execution

ID: Q89296


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), included with:
    • Microsoft Windows NT, versions 3.1, 3.5, 3.51
    • Microsoft Windows 95


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.

Additional query words: 3.10 3.50 4.00

Keywords : kbNTOS310 kbNTOS350 kbNTOS351 kbWinOS95
Version :
Platform :
Issue type :


Last Reviewed: September 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.