images\info_sml.gifMPK: Potential Memory Leak (Error Detection)

Example       Related Topics

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 a 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 multiply-inherited object and it is offset past the other base class objects.

Alternatively, leaked memory might appear as a 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.

Purify generates a list of leaked memory blocks when you do any one of the following:

§           Exit the program and Memory leaks is selected in the Errors and Leaks tab in the Default Settings dialog box or Settings for exename dialog box. This is the default.

§           Call one of the Purify API functions: PurifyNewLeaks or PurifyAllLeaks.

§           Specify /LeaksAtExit=yes at the command line.

(C) Copyright IBM Corporation 1992, 2010.