Memory Potential Leak (MPK)

Memory Profiling for C and C++

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. Another example occurs when a pointer to a C++ object is cast to the second or later base class of a multiple-inherited object and it is offset past the other base class objects.

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.

Related Topics

Memory Profiling Results | Warning Messages | Memory Profiling Settings