Resource Tracking Window

Use the Resource Tracking window to detect memory leaks in a program.

Note Note  The Resource Tracking window and associated functions are available only in the LabWindows/CVI Full Development System.

The Resources column of the Resource Tracking window displays both allocated and deallocated resources that you allocate in your program. LabWindows/CVI displays newly allocated resources in red text, existing allocated resources in black text, and recently released resources in grey text. The resources are also grouped in categories according to type; for example, memory, toolbox, user interface resources, and so on. Double-click a resource in the Resources column to go directly to the location in the source code where the resource was allocated. The Call Stack section of the Resource Tracking window shows the call stack of functions when the resource was allocated, displaying the most recently called function at the top of the list and the initial function at the bottom of the list.

Note Note  
  • RT On RT targets, leaked resources persist until you reboot the target. However, the Resource Tracking window displays only leaked resources from the most recent program execution.
  • You must call the CNVFinish function after your program is done using the Network Variable Library to discard and clean up global resources. If you do not call this function after calling other functions in the Network Variable Library, your program might hang or crash when it closes and LabWindows/CVI might not be able to report the leaked resources in your program.

Resource tracking is available at both the extended and standard debugging levels. Selecting Extended in the Debugging Options section of the Build Options dialog box enables resource tracking by default. If you select Standard, you must use the SetEnableResourceTracking function to enable resource tracking.

To view the Resource Tracking window, select Window»Resource Tracking in the active LabWindows/CVI window. Right-clicking in the Resources column of the Resource Tracking window displays the context menu with the following options:

  • Go to Source—Highlights the location in the Source window where the resource was allocated.
  • View Memory—Opens the Memory Display window and displays the memory contents that correspond to the selected item.
  • Break on Deallocation—Specifies that LabWindows/CVI suspends your program when the resource is released.
  • Show/Hide Thread IDs—Displays or hides the Thread ID column in the Resource Tracking window.
  • Clear Window—Removes all items from the Resource Tracking window.
  • Load from File—Loads a previously saved file.
  • Save to File—Saves the current contents of the Resource Tracking window to a text file for later use.
  • Sort—Opens the Sort Tree dialog box, which you can use to sort the resources in the Resource Tracking window.
  • Find—Opens the Find dialog box, which you can use to search for text in the column.
  • Expand Resource—Expands the resource category.
  • Collapse Resource—Collapses the resource category.
  • Expand All—Expands all resource categories.
  • Collapse All—Collapses all resource categories.
  • Release Window/Confine Window—LabWindows/CVI displays different options depending on whether the Resource Tracking window is in the Window Confinement Region. The Release Window command removes the window from the Window Confinement Region. The Confine Window command confines the window to the Window Confinement Region.

Right-clicking in the Call Stack section of the Resource Tracking window displays the context menu with the following options:

  • Go to Source—Highlights the location in the Source window of the function you selected.
  • Find—Opens the Find dialog box, which you can use to search for text in the column.

Right-clicking on the tab of the Resource Tracking window displays the context menu with the following options:

  • Close—Closes the window.
  • Release Window—Removes the window from the Debugging Region.

Because tracking resources creates additional overhead, enabling resource tracking affects the performance of your program.

WAS THIS ARTICLE HELPFUL?

Not Helpful