Heap Memory Tracker Probe

From OC Systems Wiki!
Jump to: navigation, search

Heap Memory Tracker Probe: hmtb.ual

(Since 4.5.2).

The hmtb.ual predefined probe tracks the use of heap memory within an application program. The probe records the location, number, and size of allocations from the heap. The tracking information is recorded as the application runs and is formatted to produce a report.

Heap tracking allows you to determine where the heap is being used in your application. The heap tracking information can be used to locate where blocks of particular sizes are allocated in your application.

See hmp.ual, memstat.ual, memleak.ual and memwatch.ual for other approaches to heap analysis.

Usage

This probe is applied at run time using aprobe as described under Profile UAL Parameters below. Heap tracking data will be collected for the standard memory functions: malloc, calloc, and realloc. You would need to modify this probe to collect information from custom allocation functions.

The heap tracking information is logged to the APD file for later processing by apformat. At format time a report is generated detailing where heap allocation points are allocated and sorted by size and number. The allocation points are organized by unique traceback paths.

The default parameters will track all allocation sizes, but upper and lower bonds can be set to focus on specific block size (and reduced the amount of collected data).

UAL Parameters

hmtb.ual is specified on the aprobe command line or in an APO file as described in Command Line. The specific options are:

aprobe  -u hmtb.ual    [-p "param-list"] your_program

where param_list may include:

-d Depth
traceback depth [5]
-i
report tracebacks inline in the tables
-l LowerBound
lower bound size cut off for tracked blocks; larger blocks will be tracked [0]
-u UpperBound
upper bound size cut off for tracked blocks; smaller blocks will be tracked [128]


Heap Memory Traceback Performance Issues

See Performance_Issues for a general discussion of factors that affect performance.

Because allocations are logged as they occur, long-running programs may need larger APD size. Use the -s option to increase the size of App files, and use the -n option to increase the number of APD files int eh ring. See APD File for more information.


Heap Memory Traceback Report

This is an example report that shows two allocation points each with 1000 calls and allocations of size 10.

Heap Memory Tracker Probe 4.5.2 (201023)
Copyright 1993-2019 OC Systems, Inc. All rights reserved.
For support/questions send mail to support@ocsystems.com.

PID: 19593 - Summary of options
   Program start: Fri Oct 23 18:33:25.345539 2020
Options:
   TracebackDepth:   9
   SizeLowerBound:   0
   SizeUpperBound:   128

--------------------------------------------------------------
Allocations sorted by size:
--------------------------------------------------------------
TbkId | NumAllocs | TotalAllocSize | AvgAllocSize
--------------------------------------------------------------
@2    	     1000	     10000	        10
@1    	     1000	     10000	        10
--------------------------------------------------------------
Allocations sorted by count:
--------------------------------------------------------------
TbkId | NumAllocs | TotalAllocSize | AvgAllocSize
--------------------------------------------------------------
@2    	     1000	     10000	        10
@1    	     1000	     10000	        10
---------------------------------------------------------
Allocation traceback ids:
---------------------------------------------------------
@2           1000   10000

         extern:"__libc_malloc()" in "libc.so"
     ==> extern:"main()" at line 22 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x8048370 in "main.exe"

@1           1000   10000

         extern:"__libc_malloc()" in "libc.so"
     ==> extern:"main()" at line 16 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x8048370 in "main.exe"