Share via


JsMemoryAllocationCallback Typedef

User implemented callback routine for memory allocation events.

Syntax

typedef bool (CALLBACK * JsMemoryAllocationCallback)(  
   _In_opt_ void *callbackState,  
   _In_ JsMemoryEventType allocationEvent,  
   _In_ size_t allocationSize  
);  

Parameters

callbackState
The state passed to JsSetRuntimeMemoryAllocationCallback.

allocationEvent
The type of type allocation event.

allocationSize
The size of the allocation.

Property Value/Return Value

For the JsMemoryAllocate event, returning true allows the runtime to continue with allocation. Returning false indicates the allocation request is rejected. The return value is ignored for other allocation events.

Remarks

Use JsSetRuntimeMemoryAllocationCallback to register this callback.

Requirements

Header: jsrt.h

See Also

Reference (JavaScript Runtime)