Gflags Remarks

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Gflags Remarks

General Information

  • To display the Gflags dialog box, at the command line, type Gflags (with no parameters).

  • To set flags in the registry or in kernel mode or to enable page heap verification, you must be a member of the Administrators group on the computer. However, users with at least Guest account access can launch a program from the Gflags dialog box.

  • Gflags system-level registry settings appear in the registry immediately, but do not take effect until you restart the system.

  • Gflags image file registry settings appear in the registry immediately, but do not take effect until you restart the process.

  • The debugger and launch features in the Gflags dialog box are program specific. You can only set them on one image file at a time.

  • For information about kernel special pool, see the Windows Driver Development Kit (DDK).

  • For information about debuggers and to obtain debuggers and documentation, see Microsoft Debugging Tools.

Flag Details

  • To clear all flags, set the flag to -FFFFFFFF. Setting the flag to 0 adds 0 to the current flag value.

  • When you set the flags for an image file to FFFFFFFF (0xFFFFFFFF), Windows clears all flags and deletes the GlobalFlag entry in the image file subkey. The subkey is retained.

Dialog Box and Command Line

You can run Gflags by using its handy dialog box or from the command line. Most features are available in both forms, with the following exceptions.

Dialog box only

  • Debugger. Specify that a particular program always runs in a debugger.

  • Launch. Run a program with the specified debugging settings.

  • Kernel Special Pool Tag. Detects kernel pool errors.

Command line only

  • Set the size of the user mode stack trace database (/tracedb).

  • Set page heap verification options.

Gflags and Page Heap

This version of Gflags includes the functionality of Pageheap.exe, a heap allocation monitoring tool formerly included in the Support Tools folder. The page heap feature reserves memory at the boundary of each allocation to trap access beyond the allocation that might otherwise go undetected.

The page heap options in Gflags let you select standard heap verification, which writes fill patterns at the end of each heap allocation and examines the patterns when the allocations are freed, or full-page heap verification, which places an inaccessible page at the end of each allocation so that the program stops immediately if it accesses memory beyond the allocation. Because full heap verification uses a full page of memory for each allocation, its widespread use can cause system memory shortages.

Use the following syntax variations to enable page heap verification:

  • To enable standard page heap verification for all processes, use gflags /r +hpa or gflags /k +hpa.

  • To enable standard page heap verification for one process, use gflags /p /enableImageFile.

  • To enable full page heap verification for one process, gflags /iImageFile**+hpa** or gflags /p /enableImageFile**/full**.

All page heap settings, except /k, are stored in the registry and remain effective until you change them.

Use care in interpreting the Enable page heap check box for an image file in the Gflags dialog box. It indicates that page heap verification is enabled for an image file, but it does not indicate whether it is full or standard page heap. If the check results from selecting the check box, then full page heap verification is enabled for the image file. However, if the check results from use of the command-line interface, then the check can represent the enabling of either full or standard page heap verification for the image file.

To determine whether a full or standard page heap verification is enabled for a program, at the command line, type gflags /p. In the resulting display, traces indicates that standard page heap verification is enabled for the program and full traces indicates that full page heap verification is enabled for the program.

Registry Information

Debugging settings saved between sessions are stored in the registry. You can use the registry APIs, Regedit.exe, or Reg to query or change these values. For information about using Reg see "Reg" in Help for Windows Server 2003. The following table lists the types of settings and where they are stored in the registry.

Systemwide debugging values. ("Registry")

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\GlobalFlag

Program-specific debugging values. ("Image file")

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ImageFile\GlobalFlag

Page heap options for an image file

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ImageFile\PageHeapFlags

User mode stack trace database size (tracedb)

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ImageFile\StackTraceDatabaseSizeInMb

Create user mode stack trace database (ust, 0x1000) for an image file

Windows adds the image file name to the value of the USTEnabled registry entry (HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\USTEnabled).

Kernel Special Pool Tags

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PoolTag

Verify Start / Verify End

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PoolTagOverruns. The Verify Start option sets the value to 0. The Verify End option sets the value to 1.

See Also

Concepts

Gflags.exe
Gflags Syntax
Gflags UI
Gflags Examples
Gflags Flag Reference
Alphabetical List of Tools
Windiff Overview
Remote Overview
Poolmon Overview
Msizap Overview
Msicuu Overview
Memsnap Overview
Devcon Overview
Pviewer Overview
Exctrlst Overview
Devcon Overview
Apmstat Overview