8#ifndef PXR_ARCH_MALLOC_HOOK_H
9#define PXR_ARCH_MALLOC_HOOK_H
68 bool Initialize(
void* (*mallocWrapper)(
size_t,
const void*),
69 void* (*reallocWrapper)(
void*,
size_t,
const void*),
70 void* (*memalignWrapper)(
size_t,
size_t,
const void*),
71 void (*freeWrapper)(
void*,
const void*),
90 return (*_underlyingMallocFunc)(nBytes);
101 return (*_underlyingReallocFunc)(ptr, nBytes);
112 return (*_underlyingMemalignFunc)(alignment, nBytes);
123 (*_underlyingFreeFunc)(ptr);
131 void* (*_underlyingMallocFunc)(size_t);
132 void* (*_underlyingReallocFunc)(
void*, size_t);
133 void* (*_underlyingMemalignFunc)(size_t, size_t);
134 void (*_underlyingFreeFunc)(
void*);
Override default malloc() functionality.
Definition mallocHook.h:54
ARCH_API void Free(void *ptr)
Call the original system free() function.
Definition mallocHook.h:122
ARCH_API void * Malloc(size_t nBytes)
Call the original system malloc() function.
Definition mallocHook.h:89
ARCH_API bool Initialize(void *(*mallocWrapper)(size_t, const void *), void *(*reallocWrapper)(void *, size_t, const void *), void *(*memalignWrapper)(size_t, size_t, const void *), void(*freeWrapper)(void *, const void *), std::string *errMsg)
Initialize hooks.
ARCH_API void * Realloc(void *ptr, size_t nBytes)
Call the original system realloc() function.
Definition mallocHook.h:100
ARCH_API void * Memalign(size_t alignment, size_t nBytes)
Call the original system memalign() function.
Definition mallocHook.h:111
ARCH_API bool IsInitialized()
Return true if *this has been (successfully) initialized.
ARCH_API bool ArchIsStlAllocatorOff()
Return true if the C++ STL allocator was requested to be turned off.
ARCH_API bool ArchIsPtmallocActive()
Return true if ptmalloc is being used as the memory allocator.