Please enable JavaScript to view this site.

Memory Validator Help

Navigation: Native API

Custom Heap Tracking

Scroll Prev Top Next More

 

API functions for tracking allocations in custom heaps

 

The following group of API functions notify Memory Validator of allocation behaviour in a custom memory manager.

 

The functions cover:

 

allocation

reallocation

free

object reference count changes (increment and decrement)

 

The dllId parameter is the index of the Memory Validator extension DLL (if any) to use.

 

You can pass two items of user defined data.

 

The Ex functions take an extra tagTracker parameter - an id returned from a call to mvAddTracker(), or 0 if you don't have one.

 

 

mvUserCustomAlloc()

mvUserCustomAllocEx()

 

extern "C" 
void mvUserCustomAlloc(void*     address,        // address of allocation
                       SIZE_T    size,           // size of allocation (bytes)
                       DWORD_PTR userData1,
                       DWORD_PTR userData2,
                       DWORD     dllId = -1);    // extDll id, -1 if none

 

extern "C" 
void mvUserCustomAllocEx(void*     address,      // address of allocation
                         SIZE_T    size,         // size of allocation (bytes)
                         DWORD_PTR userData1,
                         DWORD_PTR userData2,
                         DWORD     dllId = -1,   // extDll id, -1 if none
                         DWORD     tagTracker);  // see mvAddTracker() to get tracker id

 

mvUserCustomReAlloc()

mvUserCustomReAllocEx()

 

extern "C" 
void mvUserCustomReAlloc(void*  oldAddress,  // address of allocation
                         void*  newAddress,  // address of allocation
                         SIZE_T newSize,     // size of allocation (bytes)
                         DWORD  userData1,
                         DWORD  userData2,
                         DWORD  dllId = -1); // extDll id, -1 if none

 

extern "C" 
void mvUserCustomReAllocEx(void*     oldAddress,  // address of allocation
                           void*     newAddress,  // address of allocation
                           SIZE_T    newSize,     // size of allocation (bytes)
                           DWORD_PTR userData1,
                           DWORD_PTR userData2,
                           DWORD     dllId = -1,  // extDll id, -1 if none
                           DWORD     tagTracker); // see mvAddTracker() to get tracker id

 

 

mvUserCustomFree()

mvUserCustomFreeEx()

 

extern "C" 
void mvUserCustomFree(void* address,     // address of free
                      DWORD userData1,
                      DWORD userData2,
                      DWORD dllId = -1); // extDll id, -1 if none
 
extern "C" 
void mvUserCustomFreeEx(void*     address,     // address of free
                        DWORD_PTR userData1,
                        DWORD_PTR userData2,
                        DWORD     dllId = -1,  // extDll id, -1 if none
                        DWORD     tagTracker); // see mvAddTracker() to get tracker id

 

 

mvUserCustomRefCountDecrement()

mvUserCustomRefCountDecrementEx()

 

Notifies Memory Validator that a specific object has had its reference count decremented.

 

This is to provide support for those software using reference counting, but have no way of easily tracking where and when reference counts change.

 

extern "C" 
void mvUserCustomRefCountDecrement(DWORD data,        // address of allocation
                                   DWORD userData,
                                   DWORD userData2,
                                   DWORD dllId = -1); // extDll id, -1 if none
 
extern "C" 
void mvUserCustomRefCountDecrementEx(DWORD     data,        // address of allocation
                                     DWORD_PTR userData,
                                     DWORD_PTR userData2,
                                     DWORD     dllId = -1,  // extDll id, -1 if none
                                     DWORD     tagTracker); // see mvAddTracker() to get tracker id

 

 

mvUserCustomRefCountIncrement()

mvUserCustomRefCountIncrementEx()

 

Notifies Memory Validator that a specific object has had its reference count incremented.

 

extern "C" 
void mvUserCustomRefCountIncrement(DWORD data,        // address of allocation
                                   DWORD userData1,
                                   DWORD userData2,
                                   DWORD dllId = -1); // extDll id, -1 if none
 
extern "C" 
void mvUserCustomRefCountIncrementEx(DWORD     data,        // address of allocation
                                     DWORD_PTR userData1,
                                     DWORD_PTR userData2,
                                     DWORD     dllId = -1,  // extDll id, -1 if none
                                     DWORD     tagTracker); // see mvAddTracker() to get tracker id