Cmallspy: IMallocSpy Interface

Click to open or copy the Cmallspy project files.

The Cmallspy sample demonstrates a simple implementation of the IMallocSpy interface. When the capability for replaceable memory allocators was removed from 32-bit OLE, the ability for applications to provide their own debug allocators for OLE was also removed. OLE disallows caller-provided allocators for multithread safety and general robustness. To provide a way for applications to monitor memory allocation, detect memory leaks, and simulate memory failure, OLE now provides support for a simple wrapper for the IMalloc interface called the IMallocSpy interface.

Building SDK Samples

This sample uses the following keywords:

addref; alloc; cmallocspy; cogetmalloc; coinitialize; coregistermallocspy; corevokemallocspy; couninitialize; free; isequaliid; main; postalloc; postdidalloc; postfree; postgetsize; postheapminimize; postrealloc; prealloc; predidalloc; prefree; pregetsize; preheapminimize; prerealloc; printf; queryinterface; release; stdmethod; stdmethod_