Intel® Inspector User Guide for Windows* OS

ID 767798
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Memory Error Analysis Types

Intel Inspector offers a range of preset memory analysis types to help you control analysis scope and cost:

  • Analysis types with the narrowest scope minimize the load on the system and the time and resources required to perform the analysis; however, they detect the narrowest set of errors and provide minimal details.

  • Analysis types with the widest scope maximize the load on the system and the time and resources required to perform the analysis; however, they detect the widest set of errors and provide context and the maximum amount of detail for those errors.

TIP:
  • Use analysis types iteratively. Start with a narrow scope to verify the application is set up correctly and set expectations for analysis duration. Widen the scope only if you need more answers and you can tolerate the increased cost.

  • Estimated collection time may be 2 to 160 times longer than normal application execution time.

  • Data set size and workload have a direct impact on application execution time and analysis speed.

Some settings in each preset analysis type are configurable. If the combination of settings in a preset analysis type almost meets your needs, try fine-tuning these configurable settings.

If the combination of analysis type settings in the preset analysis types does not meet your needs at all, try creating a new custom analysis type based on the currently selected analysis type.

Memory Error Configuration Settings for Each Preset Analysis Type

The following table shows the settings (in alphabetical order) for each preset analysis type.

  • N/A means not applicable for the preset analysis type (which means any value displayed in the GUI is greyed out)

  • Configurable means you can change the setting without creating a custom analysis type.

  • Renamed/split/combined configuration settings show previous manifestations.

Configuration Settings / Preset Memory Error Analysis Types

Detect Leaks (Narrow Scope)

Detect Memory Problems

Locate Memory Problems (Wide Scope)

Analyze stack accesses

N/A

No

No (configurable)

Defer memory deallocation (previously called Byte limit before reallocation)

N/A

N/A

1 Mb

Detect invalid memory accesses (split from Detect invalid/uninitialized accesses)

No

Yes

Yes

Detect leaks at application exit (previously called Detect memory leaks upon application exit)

Yes (configurable)

Yes (configurable)

Yes (configurable)

Detect resource leaks

Yes (configurable)

Yes (configurable)

Yes (configurable)

Detect still-allocated memory at application exit (previously called Report still-allocated memory at application exit)

Yes (configurable)

Yes (configurable)

Yes (configurable)

Detect uninitialized memory reads (split from Detect invalid/uninitialized accesses)

N/A

No (configurable)

No (configurable)

Enable enhanced dangling pointer check

N/A

No

Yes

Enable guard zones

N/A

No

Yes

Enable memory growth detection (previously called Enable interactive memory growth detection)

No (configurable)

Yes (configurable)

Yes (configurable)

Enable on-demand leak detection (previously called Enable on-demand memory leak detection)

No (configurable)

Yes (configurable)

Yes (configurable)

Guard zone size (previously called Guard zone byte size)

N/A

N/A

32 bytes

Maximum number of leaks shown in result (previously called Maximum memory leaks)

100,000

100,000

100,000

Remove duplicates

Yes

Yes

Yes (configurable)

Revert to previous uninitialized memory algorithm (not recommended)

N/A

No (configurable)

No (configurable)

Stack frame depth

8 (configurable)

8 (configurable)

16 (configurable)

Memory Error Analysis Type Configuration Setting Descriptions

The following table describes the purpose, usefulness, and cost (low, medium, high, or proportional in terms of time and resources) for each analysis type configuration setting. (The settings are listed in alphabetical order.)

Setting

Purpose, Usefulness, and Cost

Analyze stack accesses

Available only if Detect invalid memory accesses is selected.

Select to analyze invalid and uninitialized accesses to thread stacks.

Selecting is useful when:

  • You want as thorough an analysis as possible.

  • An application calls alloca().

High cost.

Recommendation:

  • Select the first time you analyze an application and periodically thereafter.

  • Select to analyze automatic variables.

Defer memory deallocation (previously called Byte limit before reallocation)

Available only if Detect invalid memory accesses and Enable enhanced dangling pointer check are selected.

Select to have the Intel Inspector prevent freed memory blocks from immediately returning to the pool of available memory.

Selecting is useful for discovering if an application tries to use memory after freeing it.

High cost if an application is performing many allocations/deallocations.

Recommendation: Select to improve analysis quality if the cost is not too high.

Detect invalid memory accesses (split from Detect invalid/uninitialized accesses)

Select to detect problems where a read or write instruction references memory that is logically or physically invalid.

Selecting is useful to ensure an application accesses only valid memory.

Medium cost.

Recommendation: Select.

NOTE:

May change application behavior by initializing memory that may normally be uninitialized. If your application reads this normally uninitialized memory, it may:

  • Simply miscalculate a value.

  • Treat the memory as a pointer, deference it, and crash during analysis.

Detect leaks at application exit (previously called Detect memory leaks upon application exit)

Select to report typical memory leaks in which the application allocates a memory block, never releases it, and doesn’t keep a pointer to the block (e.g. unreachable memory blocks).

Selecting is useful when an application:

  • Runs out of memory.

  • Appears to be using more memory than expected.

Extremely low cost – especially if used only with Remove duplicates selected.

Recommendation: Select.

Detect resource leaks

Select to detect open kernel and GDI handles when the application ends. For example, the application may open a file, get its handle, but never close or release that handle until it stops running. On Windows, GDI resources are limited, and the application may experience some drawing issues if it uses more than ~10,000 of these types of handles at once (pen, bitmap, brush, etc.)

Selecting is useful if you see constant growth in acquired kernel and GDI objects in the system task manager for your process.

Low cost.

Recommendation: Select unless you want to focus on memory problems exclusively.

Detect still-allocated memory at application exit (previously called Report still-allocated memory at application exit)

Available only if Detect leaks at application exit is selected.

Select to report typical memory leaks in which the application allocates a memory block, doesn’t deallocate it, but a valid variable still holds a pointer to that block when the application ends (e.g. reachable memory blocks).

Cost is proportional to the number of memory blocks still allocated when the application stops executing.

Recommendation: Select to investigate memory growth.

Detect uninitialized memory reads (split from Detect invalid/uninitialized accesses)

Available only if Detect invalid memory accesses is selected.

Select to detect problems where a read instruction accesses an uninitialized memory location.

Selecting is useful when an application:

  • Exhibits unexpected behavior.

  • Shows evidence of uninitialized values in computations.

High cost.

Recommendation: Deselect.

NOTE:

May change application behavior by initializing memory that may normally be uninitialized. If your application reads this normally uninitialized memory, it may:

  • Simply miscalculate a value.

  • Treat the memory as a pointer, deference it, and crash during analysis.

Enable enhanced dangling pointer check

Available only if Detect invalid memory accesses is selected.

Select to detect if an application is trying to access memory after it was logically freed.

May be higher cost if an application is performing many allocations/deallocations, and the Defer memory deallocation list value is smaller than the amount of memory the application allocates.

Recommendation: Select when an application exhibits unexpected behavior you suspect may be caused by a dangling pointer.

NOTE:
  • Changes application behavior by intercepting calls to deallocators and deferring actual deallocation.

  • Enhanced dangling pointer check is not supported for new/delete and new[]/delete[] allocation/deallocation pairs.

Enable guard zones

Available only if Detect invalid memory accesses is selected.

Use in conjunction with Guard zone size to show offset information if the Intel Inspector detects memory use beyond the end of an allocated block.

Selecting is useful when:

  • An application exhibits unexpected behavior.

  • You need more context about heap allocations to interpret Invalid memory access problems.

Cost is proportional to number of allocations.

Recommendation: Select unless:

  • Intel Inspector runs out of memory.

  • An application becomes destabilized.

NOTE:

  • May change application behavior.

  • Increases the amount of memory the Intel Inspector uses.

  • Intel Inspector creates guard zones only at the end of allocated space, not at the start of allocated space.

Enable memory growth detection (previously called Enable interactive memory growth detection)

Select to enable buttons in the GUI that let you send commands during application execution. This will show you a list of reachable and unreachable memory blocks for a time segment.

Selecting is useful for modeling memory usage patterns and ensuring a transactional application deallocates all memory allocations after a transaction completes.

Use in conjunction with the Reset Growth Tracking and Measure Growth buttons during analysis.

Low cost.

Enable on-demand leak detection (previously called Enable on-demand memory leak detection)

Select to enable buttons in the GUI that let you send “leak” commands. This will show you a list of unreachable memory blocks for a time segment.

Selecting is useful for checking for memory leaks in an application that never exits, or in only the portion of an application for which you are responsible.

Use in conjunction with the Reset Leak Tracking and Find Leaks buttons during analysis.

Cost is proportional to the number of allocations.

Guard zone size (previously called Guard zone byte size)

Available only if Detect invalid memory accesses and Enable guard zones are selected.

Use in conjunction with Enable guard zones to set the number of bytes beyond the allocated block of memory the Intel Inspector reserves to identify Invalid memory access problems related to the allocation.

Setting is useful when:

  • An application exhibits unexpected behavior.

  • You need more context about heap allocations to interpret Invalid memory access problems.

Cost is proportional to number of allocations.

Recommendation: Set unless:

  • Intel Inspector runs out of memory.

  • An application becomes destabilized.

NOTE:

  • May change application behavior.

  • Increases the amount of memory the Intel Inspector uses.

  • Intel Inspector creates guard zones only at the end of allocated space, not at the start of allocated space.

Maximum number of leaks shown in result (previously called Maximum memory leaks)

Use to set the maximum number of leaks the Intel Inspector shows in a result after analysis is complete.

A zero setting shows all detected memory leaks.

Cost is proportional to the number of leaks.

Recommendation: Use the default value unless you want an exhaustive list of all leaks.

TIP:

Even the default value can generate an unmanageable number of leaks. Consider sorting the displayed memory leaks by Object Size, fixing the largest leaks, and then re-inspecting your application. Or use the on-demand leak detection feature to narrow your focus and eat the elephant one bite at a time.

Remove duplicates

Deselect to show all occurrences of a detected problem in the Code Locations pane.

Deselecting is:

  • Useful when you need to fully visualize all threads and problem occurrences in relation to time

  • Low cost in terms of time; however, the number of duplicate errors could crowd out the number of unique errors.

Recommendation: Select.

Revert to previous uninitialized memory algorithm (not recommended)

Available only if Detect uninitialized memory reads is selected.

The current algorithm for detecting uninitialized memory reads decreases false positives but increases analysis time and memory overhead. Select to use the previous version of the algorithm.

Recommendation: Deselect.

Stack frame depth

Use to provide more or less call stack context for detected errors.

A high setting is useful when analyzing highly object-oriented applications.

A higher number does not significantly impact cost.

Recommendation: Use only as large a value as an application requires to display complete call paths.