Custom Memory Allocation Example
Provides Purify with information about a pending memory reallocation. Call this function right before invoking custom memory block reallocation code.
size_t PurifyPreRealloc(void *pRequest, size_t cbRequest, void **ppNewRequest, unsigned int dwFlags)
pRequest |
A pointer to the base of the block to be reallocated, within the block's red zones. |
cbRequest |
The requested block size, within the block's red zones. |
ppNewRequest [out] |
A returned pointer to the actual base (including red zones) of the block to be reallocated, for use during actual reallocation. |
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 |
PURIFY_TRACK_NO_REDZONE |
Purify should not pad the block with red zones |
n |
Where n is the total size (including red zones) of the block to be reallocated. |
§ This function supplies Purify with information about a pending memory block reallocation. If Purify is tracking the memory block to be reallocated, this function returns the block's actual size and base address for use by your custom reallocation code. These actual values include the red zones that have provided Purify array-bounds detection to any of your code that has been using the block prior to its reallocation. Use this function in conjunction with the PurifyPostRealloc() function, which indicates to Purify that the reallocation is complete.
§ 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 reallocation routines. Purify automatically intercepts standard Windows and C runtime reallocation API functions.
(C) Copyright IBM Corporation 1992, 2010.