About memory profiling reports

After execution of an instrumented application, the Memory Profiling report provides a summary diagram and a detailed report for both byte and memory block usage.

A memory block is a number of bytes allocated with a single malloc instruction. The number of bytes contained in each block is the actual amount of memory allocated by the corresponding allocation instruction.

Summary diagrams

The summary bar graph diagrams provide a quick overview of memory usage in blocks and bytes, where:
  • Allocated is the total memory allocated during the execution of the application.
  • Unfreed is the memory that remains allocated after the application was terminated.
  • Maximum is the highest memory usage encountered during execution.

Detailed report

The detailed section of the report lists memory errors and warnings described in the following paragraphs.

You can use the Filter Errors and Warnings button to select the level of information that you want to display.

Detected memory errors

Error messages indicate invalid program behavior. These are serious issues you should address before you check in code.

Freeing Freed Memory (FFM)

An FFM message indicates that the program is trying to free memory that has previously been freed.

This message can occur when one function frees the memory, but a data structure retains a pointer to that memory and later a different function tries to free the same memory. This message can also occur if the heap is corrupted.

Memory Profiling maintains a free queue, whose role is to actually delay memory free calls in order to compare with upcoming free calls. The length of the delay depends on the Free queue length and Free queue threshold Memory Profiling Settings. A large deferred free queue length and threshold increases the chances of catching FFM errors long after the block has been freed. A smaller deferred free queue length and threshold limits the amount of memory on the deferred free queue, taking up less memory at run time but providing a lower level of error detection.

Freeing Unallocated Memory (FUM)

An FUM message indicates that the program is trying to free unallocated memory.

This message can occur when the memory is not yours to free. In addition, trying to free the following types of memory causes a FUM error:
  • Memory on the stack.
  • Program code and data sections.
Freeing Invalid Memory (FIM)

An FIM message indicates that the program is trying to free allocated memory with the wrong instruction.

This message can occur when the memory free instruction mismatches the memory allocation instruction. For example, a FIM occurs when memory is freed with a free instruction when it was allocated with a new instruction.

Late Detect Array Bounds Write (ABWL)

An ABWL message indicates that the program wrote a value before the beginning or after the end of an allocated block of memory.

Memory Profiling checks for ABWL errors whenever free() or dump() routines are called, or whenever the free queue is actually flushed.

This message can occur when you:
  • Make an array too small. For example, you fail to account for the terminating NULL in a string.
  • Forget to multiply by sizeof(type) when you allocate an array of objects.
  • Use an array index that is too large or is negative.
  • Fail to NULL terminate a string.
  • Are off by one when you copy elements up or down an array.

Memory Profiling actually allocates a larger block by adding a Red Zone at the beginning and end of each allocated block of memory in the program. Memory Profiling monitors these Red Zones to detect ABWL errors.

Increasing the size of the Red Zone helps HCL OneTest™ Embedded catch bounds errors before or beyond the block at the expense of increased memory usage. You can change the Red Zone size in the Memory Profiling Settings.

The ABWL error does not apply to local arrays allocated on the stack.

Note: The ABWL error in the HCL OneTest Embedded Memory Profiling tool only applies to heap memory zones and not to global or local tables.
Late Detect Free Memory Write (FMWL)

An FMWL message indicates that the program wrote to memory that was freed.

This message can occur when you:
  • Have a dangling pointer to a block of memory that has already been freed (caused by retaining the pointer too long or freeing the memory too soon).
  • Index far off the end of a valid block.
  • Use a completely random pointer which happens to fall within a freed block of memory.

Memory Profiling maintains a free queue, whose role is to actually delay memory free calls in order to compare with upcoming free calls. The length of the delay depends on the Free queue length and Free queue threshold Memory Profiling Settings. A large deferred free queue length and threshold increases the chances of catching FMWL errors. A smaller deferred free queue length and threshold limits the amount of memory on the deferred free queue, taking up less memory at run time but providing a lower level of error detection.

Memory Allocation Failure (MAF)
An MAF message indicates that a memory allocation call failed. This message typically indicates that the program ran out of paging file space for a heap to grow. This message can also occur when a non-spreadable heap is saturated. After Memory Profiling displays the MAF message, a memory allocation call returns NULL in the normal manner. Ideally, programs should handle allocation failures.
Freeing Freed Memory (FFM)

An MAF message indicates that a memory allocation call failed. This message typically indicates that the program ran out of paging file space for a heap to grow. This message can also occur when a non-spreadable heap is saturated.

After Memory Profiling displays the MAF message, a memory allocation call returns NULL in the normal manner. Ideally, programs should handle allocation failures.

Core Dump (COR)

A COR message indicates that the program generated a UNIX core dump. This message can only occur when the program is running on a UNIX target platform.

Detected memory warnings

Warning messages indicate a situation in which the program might not fail immediately, but might later fail sporadically, often without any apparent reason and with unexpected results. Warning messages often pinpoint serious issues you should investigate before you check in code.

Memory in Use (MIU)
An MIU message indicates heap allocations to which the program has a pointer.
Note: On exit, small amounts of memory in use in programs that run for a short time are not significant. However, you should fix large amounts of memory in use in long running programs to avoid out-of-memory problems.

Memory Profiling generates a list of memory blocks in use when you activate the MIU Memory In Use option in the Memory Profiling Settings.

Memory Leak (MLK)

An MLK message describes leaked heap memory. There are no pointers to this block, or to anywhere within this block. Memory Profiling generates a list of leaked memory blocks when you activate the MLK Memory Leak option in the Memory Profiling Settings.

This message can occur when you allocate memory locally in some function and exit the function without first freeing the memory. This message can also occur when the last pointer referencing a block of memory is cleared, changed, or goes out of scope. If the section of the program where the memory is allocated and leaked is executed repeatedly, you might eventually run out of swap space, causing slow downs and crashes. This is a serious problem for long-running, interactive programs.

To track memory leaks, examine the allocation location call stack where the memory was allocated and determine where it should have been freed.

You can ignore memory leaks that do not have a call stack, for memory allocations that occur before the application starts by changing the configuration.

Memory Potential Leak (MPK)

An MPK message describes heap memory that might have been leaked. There are no pointers to the start of the block, but there appear to be pointers pointing somewhere within the block. In order to free this memory, the program must subtract an offset from the pointer to the interior of the block. In general, you should consider a potential leak to be an actual leak until you can prove that it is not by identifying the code that performs this subtraction.

Memory in use can appear as an MPK if the pointer returned by some allocation function is offset. This message can also occur when you reference a substring within a large string.

Alternatively, leaked memory might appear as an MPK if some non-pointer integer within the program space, when interpreted as a pointer, points within an otherwise leaked block of memory. However, this condition is rare.

Inspection of the code should easily differentiate between different causes of MPK messages.

Memory Profiling generates a list of potentially leaked memory blocks when you activate the MPK Memory Potential Leak option in the Memory Profiling Settings.

File in Use (FIU)

An FIU message indicates a file that was opened, but never closed. An FIU message can indicate that the program has a resource leak.

Memory Profiling generates a list of files in use when you activate the FIU Files In Use option in the Memory Profiling Settings.

Signal Handled (SIG)

A SIG message indicates that a system signal has been received.

Memory Profiling generates a list of received signals when you activate the SIG Signal Handled option in the Memory Profiling Settings.

Feedback