PurifyPreGetSize

Custom Memory Allocation Example

Related Topics

Description

Provides Purify with information about a pending memory block size request. Call this function right before invoking custom code that looks up a memory block's size.

Syntax

void *PurifyPreGetSize(void *pRequest, unsigned int dwFlags)

 

pRequest

The address of the block whose size is to be determined, 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

PURIFY_TRACK_NO_REDZONE

Purify should not pad the block with red zones

Returns

Where n is a pointer to the actual base (including red zones) of the block whose size is to be determined.

Notes

§      This function supplies Purify with information about a pending memory block size lookup. If Purify is tracking the memory block, this function returns its actual base address, for use by your custom code that looks up the block's size. This actual base address value includes the red zones that provide Purify array-bounds detection to any of your code that uses the block. Use this function in conjunction with the PurifyPostGetSize() function, which indicates to Purify that the block size lookup 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 memory blocks that have been created by custom allocation routines. Purify automatically intercepts standard Windows and C runtime API functions.

(C) Copyright IBM Corporation 1992, 2010.