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 just before invoking the IMalloc::Freemethod to ensure that the pointer passed to IMalloc::Freepoints to the beginning of the actual allocation.

Syntax

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

Parameters

pRequest

[in] Pointer to the block of memory that the caller is passing to IMalloc::Free.

fSpyed

[in] TRUE if the pRequestparameter of IMallocSpy::PreFreewas allocated while the spy was installed, otherwise FALSE. This value is also passed to the IMallocSpy::PostFreemethod.

Return Value

The actual pointer to pass to IMalloc::Free.

Remarks

If the IMallocSpy::PreAllocmethod modified the original allocation request passed to the IMalloc::Allocmethod (or IMalloc::Realloc), IMallocSpy::PreFreemust supply a pointer to the actual allocation, which COM will pass to IMalloc::Free.

For example, if the PreAlloc/ PostAllocpair attached a header used to store debug information to the beginning of the caller's allocation, PreFreemust return a pointer to the beginning of this header so that all of the block that was allocated can be freed.

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