There are many ways to allocate and free memory. Many system functions assume that supplied arguments are valid and do not check them thoroughly. This creates opportunities to introduce bugs when you use these routines incorrectly. For example, if a block of memory allocated by the C++ operator new is released by a call to free, the memory can be deallocated, but data structures maintained by the new and delete functions might be left pointing to the freed memory. The program continues to run until the corrupted C++ heap structures are accessed again, perhaps by a subsequent call to new. Purify detects this condition and reports a Freeing Mismatched Memory (FMM) message.
If an attempt is made to free a local variable on the stack, the call might succeed (even though the request is illegal). This is because many implementations of free simply enqueue the specified address on a free list. A subsequent dynamic memory allocation might incorrectly return memory from the stack region previously freed. Using this memory then corrupts other local variables, or even function return addresses, potentially resulting in functions returning to a non-existent calling routine.
Purify validates that the correct functions are used with each type of memory, and issues a Freeing Invalid Memory (FIM) message if the program attempts to free unallocated or invalid memory.
(C) Copyright IBM Corporation 1992, 2010.