Viewing GDI Objects

Whilst debugging graphical applications, it can be useful to track GDI and USER objects to see if any resources are leaked. In the process of performing this task, whilst it is useful to have the handle value and stack trace for the allocation, it is also very useful to be able to view what the graphical object looks like.

 

Options

No specific options are required for this feature – you simply need to collect and display the appropriate handle types.

On the Memory tab display settings dialog, select the Handles check box.

Memory Validator GDI display settings

On the Collect tab of the settings dialog, select the GDI Handles and User Handles check box.

Memory Validator GDI collect settings

 

 

Example

  • Start the nativeExample.exe application.
  • On the Handles menu, choose the Create Font option.
  • On the Handles menu, choose the Create Pen option.
  • On the Handles menu, choose the Create Brush option.
  • On the Handles menu, choose the Create Bitmap option.
  • Press Refresh on the Memory tab. All current memory and handles will be displayed.
  • Find the entry for the font you created (you may need to scroll to the bottom of the display), and click on the entry with the right mouse button. A context menu will be displayed. As shown below:Memory Validator memory view context menu
  • Select Show GDI Object…. The Font selected will be shown in a dialog, as shown below:Memory Validator GDI Font viewer
  • Repeat this process of right clicking on the GDI object of interest and choosing Show GDI Object…. The appropriate dialog will be displayed. Samples for Pen, Brush and Bitmap are shown below.Memory Validator GDI pen viewerMemory Validator GDI Brush viewer

    Memory Validator GDI Bitmap viewer

Fully functional, free for 30 days