Windows CE .NET

This method is called by COM just prior to any call to the IMalloc::GetSize method.

void* PreGetSize(
  void* pRequest, 
  BOOL fSpyed 


[in] Pointer the caller is passing to IMalloc::GetSize.
[in] TRUE if the allocation was done while the spy was active, otherwise FALSE.

Return Values

Pointer to the actual allocation for which the size is to be determined.


The IMallocSpy::PreGetSize method receives as its pRequest parameter the pointer the caller is passing to IMalloc::GetSize. It must then return a pointer to the actual allocation, which may have altered pRequest in the implementation of either the IMallocSpy::PreAlloc method or the IMallocSpy::PreRealloc method. The pointer to the true allocation is then passed to IMalloc::GetSize as its pv parameter.

IMalloc::GetSize then returns the size determined, and COM passes this value to the IMallocSpy::PostGetSize method in cbActual.

Note   The size determined by IMalloc::GetSize is the value returned by the Win32 function HeapSize. Implementers of IMallocSpy::PostGetSize cannot assume that if cbActual is sizeof(debug_header), the value is the actual size of the user's allocation.

To determine whether the platform supports this interface, see Determining Supported COM APIs.


OS Versions: Windows CE 3.0 and later.
Header: Objidl.h, Objidl.idl.
Link Library: Ole32.lib

See Also

CoRegisterMallocSpy | CoRevokeMallocSpy | HeapSize | IMalloc::GetSize | IMallocSpy::PostGetSize | IMallocSpy::PreAlloc | IMallocSpy::PreRealloc

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.