Restrict the display using watermarks

This tutorial assumes that you have read the tutorial on collecting memory leaks and that you have built the sample application. If you have no done this, please do do before continuing with this tutorial. The memory leak tutorial is here.

 

This tutorial demonstrates how to restrict the display to show only data between two actions when using the sample application.

  • Start your program using Memory Validator’s launch program option.Memory Validator launch toolbarThe launch application wizard displayed.

    Memory Validator launch wizard

    Select [installdir]\nativeExample\debugNonLink\nativeExample.exe using the Browse… button. Accept all default settings and move through all pages of the wizard to the last page. Click the Start Application button.

     

  • Use nativeExample.exe as normal.
  • Using Memory Validator Managers menu, select Add watermark at most recent trace.Context menu, add watermark
  • A dialog is displayed, asking for the name of the watermark.Memory Validator add watermark dialogType before dll load and click OK.
  • Now load the dependent DLLs from the DLL menu, option Load dependent DLLs. This menu option causes the example application to load a DLL A that is dependent on DLL B that is dependent on DLL C. The act of loading DLL A causes DLL B and DLL C to load. Each DLL allocates an object defined in a different DLL.Context menu, Load dependent DLLs
  • Using Memory Validator Managers menu, select Add watermark at most recent trace.
  • A dialog is displayed, asking for the name of the watermark.Memory Validator add watermark dialogType after dll load and click OK.
  • Using Memory Validator, select the Memory tab and click Refresh. The display will show all allocations made by the application that have not been deallocated. The display will look similar to this:Memory Validator results selected by watermarksIf you scroll down the display you will see an image similar to this:

    Memory Validator results display with watermarks

    You can see the two watermarks on the display, highlighted in cyan with the watermark name. The data items between the watermarks are the data items allocated and not freed when the Load dependent DLLs menu action was performed in the example application.

  • Using the watermark combo boxes on the Memory Tab make the selection shown below:Memory Validator watermark selection combo boxesand click Refresh.

    The display using watermarks is shown below.

    Memory Validator results with watermarks

  • As you can see, the display has been restricted to showing the data collected between two watermarks. You can create as many watermarks as you desire, and you can select any two watermarks to display data between. Watermarks can also be set using the linkable Memory Validator API so that you can set watermarks from within your code at position where user interface intervention is not possible.When your test application exits, all memory statuses are updated and any allocations between the watermarks that have not been deallocated will be displayed. The picture below shows the example application data after the example application has exited.Memory Validator memory leak results with watermarks

Fully functional, free for 30 days