Hook Function

The Microsoft Foundation Class Library debug memory allocator can call a user-defined hook function to allow the user to control whether to permit the allocation.

Allocation hook functions are prototyped as:

BOOL AllocHook( size_t nSize, BOOL bObject, LONG lRequestNumber );

Parameter Description

nSize The size of the proposed memory allocation.
bObject TRUE if the allocation is for a CObject-derived object.
lRequestNumber The memory allocation's sequence number.

Return Value

TRUE if you want to permit the allocation; otherwise FALSE.