PERF_MEM_ALLOC callback function

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

AllocSize

Number of bytes to allocate.

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

   
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