PERF_MEM_ALLOC callback function (perflib.h)

Providers implement this function to provide custom memory management for PERFLIB. PERFLIB calls this callback when it needs to allocate memory. By default, PERFLIB uses the process heap to allocate memory.

The PERF_MEM_ALLOC type defines a pointer to this callback function. The AllocateMemory function is a placeholder for the application-defined function name.

Syntax

PERF_MEM_ALLOC PerfMemAlloc;

LPVOID PerfMemAlloc(
  [in] SIZE_T AllocSize,
  [in] LPVOID pContext
)
{...}

Parameters

[in] AllocSize

Number of bytes to allocate.

[in] pContext

Context information set in the pMemContext member of PERF_PROVIDER_CONTEXT.

Return value

Pointer to the allocated memory or NULL if an error occurred.

Remarks

If you used the -MemoryRoutines when calling CTRPP, you must implement this callback function. You pass the name of your callback function to CounterInitialize.

Windows Vista:  The CounterInitialize function is named PerfAutoInitialize.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header perflib.h

See also

FreeMemory

PERF_PROVIDER_CONTEXT