Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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

Syntax

void* PreGetSize(
  void* 
pRequest, 
  BOOL 
fSpyed 
);

Parameters

pRequest

[in] Pointer the caller is passing to IMalloc::GetSize.

fSpyed

[in] TRUE if the allocation was done while the spy was active, otherwise FALSE.

Return Value

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

Remarks

The IMallocSpy::PreGetSizemethod receives as its pRequestparameter the pointer the caller is passing to IMalloc::GetSize.

It must then return a pointer to the actual allocation, which may have altered pRequestin the implementation of either the IMallocSpy::PreAllocmethod or the IMallocSpy::PreReallocmethod.

The pointer to the true allocation is then passed to IMalloc::GetSizeas its pvparameter.

IMalloc::GetSizethen returns the size determined, and COM passes this value to the IMallocSpy::PostGetSizemethod in cbActual.

Note:
The size determined by IMalloc::GetSizeis the value returned by the Win32 function HeapSize. Implementers of IMallocSpy::PostGetSizecannot assume that if cbActualis 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.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also