IMallocSpy  ZDU_T4

The IMallocSpy interface is a debugging interface that allows application developers to monitor (spy on) memory allocation, detect memory leaks and simulate memory failure in calls to IMalloc methods.

 

Caution  The IMallocSpy interface is intended to be used only to debug application code under development. Do not ship this interface to retail customers of your application, because it causes severe performance degradation and could conflict with user-installed software to produce unpredictable results.

 

When to Implement

Implement this interface to debug memory allocation during application development.

When to Use

When an implementation of IMallocSpy is registered with CoRegisterMallocSpySX_AGF, OLE calls the pair of IMallocSpy methods around the corresponding IMallocOCJ0KK method. You would not make direct calls to IMallocSpy methods. The OLE SDK contains a sample implementation of IMallocSpy. The call to the pre-method through the return from the corresponding post-method is guaranteed to be thread-safe in multi-threaded operations.

Methods in Vtable Order

IUnknown1NEM0LU Methods

Description

QueryInterface2Y54585

Returns pointers to supported interfaces.

AddRef1SHW0SS

Increments reference count.

ReleaseDUW01A

Decrements reference count.

 

IMallocSpy Methods

Description

PreAllocIOU.4F

Called before invoking IMalloc::Alloc1THWWZM, and may extend or modify the allocation to store debug information.

PostAllocU43KGH

Called after invoking IMalloc::Alloc.

PreFree135_MA.

Called before invoking IMalloc::Free62NW.NT.

PostFree4250_PW

Called after invoking IMalloc::Free.

PreRealloc2JYZ0VE

Called before invoking IMalloc::Realloc5HRJV..

PostRealloc.G4YCT

Called after invoking IMalloc::Realloc.

PreGetSize16C21PP

Called before invoking IMalloc::GetSize65AX.OK.

PostGetSize7BOOAT

Called after invoking IMalloc::GetSize.

PreDidAlloc1F9V9XU

Called before invoking IMalloc::DidAlloc4NPHFW.

PostDidAllocY3I08H

Called after invoking IMalloc::DidAlloc.

PreHeapMinimizeAHAS5P

Called before invoking IMalloc::DidAlloc4NPHFW.

PostHeapMinimizeK52SM1

Called after invoking IMalloc::HeapMinimize329F535.

 

See Also

IMalloc, CoGetMalloc, CoRegisterMallocSpy