Memory profiling errors

Error messages indicate invalid program behavior. These are serious issues that 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, which are specified in the memory profiling configuration 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. HCL OneTest™ Embedded checks for ABWL errors whenever free() or dump() routines are called, or whenever the free queue is actually flushed. This message can occur in the following situations:
  • An array is too small. For example, you fail to account for the terminating NULL in a string.
  • You forgot to multiply by sizeof(type) when you allocate an array of objects.
  • Code uses an array index that is too large or is negative.
  • Fail to NULL terminate a string.
  • Code is off by one when copying 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. These red zones are monitored to detect ABWL errors. Increasing the size of the red zone helps catch bound errors before or beyond the block, at the expense of increased memory usage. You can change the red zone size in the memory profiling configuration settings. The ABWL error does not apply to local arrays allocated on the stack.
Note: Unlike UNICOM PurifyPlus, the ABWL error in the HCL OneTest Embedded 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 in the following situations:
  • There is 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 is far off the end of a valid block.
  • A completely random pointer 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 displaying 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.

Feedback