Custom Memory Allocation Example
Provides Purify with information about a pending memory deallocation. Call this function right before invoking custom memory block deallocation code.
void *PurifyPreFree(void *pRequest, unsigned int dwFlags)
pRequest |
The base address of the block to be deallocated, within the block's red zones. |
dwFlags |
May include any of the following flags, or 0 to indicate none of them: |
Flag |
Meaning |
PURIFY_TRACK_AS_HEAP |
The block is allocated within a Windows heap |
n |
Where n is a pointer to the actual base (including red zones) of the block to be deallocated.. |
§ This function supplies Purify with information about a pending memory block deallocation. If Purify is tracking the memory block to be deallocated, this function returns the block's actual size for use by your custom deallocation code. This actual size value includes the red zones that have provided Purify array-bounds detection to any of your code that has used the block. Use this function in conjunction with the PurifyPostFree() function, which indicates to Purify that the deallocation is complete.
§ Purify cannot detect free-memory reads or writes involving blocks that are deallocated by custom deallocation functions. Purify also cannot detect multiple attempts to free such blocks.
§ This function is a member of Purify's memory tracking interface. The example code provided for Purify's memory tracking interface demonstrates this function.
§ This function is necessary only for custom memory deallocation routines. Purify automatically intercepts standard Windows and C runtime deallocation API functions.
(C) Copyright IBM Corporation 1992, 2010.