Click to Rate and Give Feedback
MSDN
MSDN Library
COM
COM Fundamentals
Reference
Interfaces
IMallocSpy

  Switch on low bandwidth view
IMallocSpy Interface

Enables application developers to monitor (spy on) memory allocation, detect memory leaks, and simulate memory failure in calls to IMalloc methods.

When To Implement

Implement this interface to debug memory allocation during application development.

Caution  The IMallocSpy interface is intended only for use in debugging 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 Use

When an implementation of IMallocSpy is registered with CoRegisterMallocSpy, COM calls the pair of IMallocSpy methods around the corresponding IMalloc method. You would not make direct calls to IMallocSpy methods.

The call to the pre-method through the return from the corresponding post-method is guaranteed to be thread-safe in multithreaded operations.

Methods

The IMallocSpy interface inherits the methods of the IUnknown interface.

In addition, IMallocSpy defines the following methods.

MethodDescription

PreAlloc

Performs operations required before calling IMalloc::Alloc.

PostAlloc

Performs operations required after calling IMalloc::Alloc.

PreFree

Performs operations required before calling IMalloc::Free.

PostFree

Performs operations required after calling IMalloc::Free.

PreRealloc

Performs operations required before calling IMalloc::Realloc.

PostRealloc

Performs operations required after calling IMalloc::Realloc.

PreGetSize

Performs operations required before calling IMalloc::GetSize.

PostGetSize

Performs operations required after calling IMalloc::GetSize.

PreDidAlloc

Performs operations required before calling IMalloc::DidAlloc.

PostDidAlloc

Performs operations required after calling IMalloc::DidAlloc.

PreHeapMinimize

Performs operations required before calling IMalloc::HeapMinimize.

PostHeapMinimize

Performs operations required after calling IMalloc::HeapMinimize.

 

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderObjIdl.h
IDLObjIdl.idl
IIDIID_IMallocSpy is defined as 0000001d-0000-0000-C000-000000000046

See Also

CoGetMalloc
CoRegisterMallocSpy
CoRevokeMallocSpy
IMalloc

Send comments about this topic to Microsoft

Build date: 7/9/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker