Analyzing Memory Usage of C/C++/Fortran Applications
See Also
The Memory Usage profiling tool runs by default for C, C++, and Fortran projects,
and shows how your application's memory heap changes over its runtime.
You can use it to identify memory leaks, which are points in your
program where memory that is no longer needed fails to be released.
Memory leaks can lead to increased memory consumption in your program.
Note: The profiling tools are supported only on platforms shown in
Overview of C and C++ Profiling.
To view more detailed information about memory usage:
- In the Run Monitor window, click the Memory Leaks button to open the Memory Leak Details tab to display the locations
of memory leaks, the number of bytes lost through leaks, and the number of leaks. The leak locations
are listed as
function-name at filename:nn
, where nn
is the line number
in the source file.
- Click a column heading to sort the list of functions using the information in that column.
- Double-click functions shown in bold to open the source files where they are called. Numbers
displayed in the left margin are the memory leak metrics for that function.
- Use the Time Filter controls in the Memory Leak Details tab to specify Start and End times to select a particular
time period of the run time to look at. You can also use the orange controls in the Run Monitor window
to select the time period.
If you see a message that detailed information is not available in the current profile configuration:
- Right-click the project and select Properties.
- Click the Profile node in the Project Properties dialog.
- In the Profile Configuration list, select the C/C++ DTrace Standard configuration
if you are running on Oracle Solaris, or C/C++ Oracle Solaris Studio Standard if you are running
on Linux with the Oracle Solaris Studio tool collection.
Tip: If you do not see these configurations, your operating system and tool collection
do not support the advanced profiling features.
- Click OK.
- Run the project and you should be able to click the Memory Leaks button and see detailed
information.
To disable Memory Usage profiling in the Run Monitor:
- Modify an existing profile configuration to deselect the Memory Usage tool. For information
about modifying a profile configuration, see
Managing Profile Configurations.
To disable all Run Monitor profiling tools:
Legal Notices