An important part of Purify's error detection involves tracking malloc and free calls. If you use custom memory-management layers rather than calling malloc or free directly, you might need to modify them slightly to make them compatible with Purify.
You can preserve your custom memory manager's semantics and implementation during normal operation, but provide an alternate implementation that uses malloc and free when the program is Purify'd.
There are five categories of custom memory managers:
Malloc veneers are layers over malloc and free that check error returns so that the callers do not have to. You do not need to modify malloc veneers when you use Purify because the actual allocation and freeing is still done by malloc and free.
Improved mallocs are allocation packages
that are better than the malloc and free in the C library. For example, they can reduce
memory fragmentation or perform garbage collection. Improved mallocs present the same interface as the standard
malloc and free functions.
You do not need to modify improved mallocs
when you use Purify because Purify does not replace the malloc, it merely intercepts calls to it.
Fixed-size allocators work by requesting
a large block of memory using malloc and then
allocating many fixed size sub-blocks. These allocators are more efficient
than malloc because the sub-blocks do not need
any size overhead.
You must make
minor changes to fixed-size allocators when you use Purify.
Pool allocators allow an application
to specify a location identifier in addition to a size when making a memory
allocation request, thus reducing the amount of paging. These memory managers
can also support pool-level operations, such as printing or freeing an
entire pool.
You must make
minor changes to pool allocators when you use Purify.
Sbrk allocators have application-specific
semantics and use the system call sbrk to allocate
memory rather than using malloc. To preserve
compatibility with library routines, sbrk allocators
generally implement a malloc interface in addition
to their application-specific interface.
You must make
several changes to sbrk allocators when you use Purify.