Checking Custom Memory Allocators
The pointer checker is not supported on
Many C and C++ applications use standard memory allocation functions to allocate large chunks of memory and then define their own custom memory allocation functions to allocate these large chunks of memory into smaller chunks. If you use the pointer checker on a module that contains custom memory allocation functions, every memory allocation from these custom functions will have the bounds information from the large chunk of memory.
To create the correct bounds information for a pointers in a custom memory allocator function, use the
For example, consider the case where you create a custom memory allocator function that returns a pointer. To add the exact bounds information to the return pointer, use the
__chkp_make_bounds()intrinsic function in the return value:
Adding exact bounds information to a return pointer
If you override the
newoperator in C++, you can use the same technique to give bounds information to the return pointer.