CHttpFilterContext::AllocMem

LPVOID AllocMem( DWORD cbSize, DWORD dwReserved );

Return Value

A pointer to a buffer, or NULL on error.

Parameters

cbSize

Specifies the size of the memory buffer to allocate, in bytes.

dwReserved

Reserved for future use.

Remarks

Call this member function to allocate memory that is automatically freed when the communication with the client is terminated.

When an HTTP filter is registered, usually it will register for the end-of-net-session event. This event is a good time to recycle any buffers used by that client request. For performance reasons, most filters will probably keep a pool of filter buffers and only allocate or free a buffer when the pool becomes empty or too large to save on the overhead of the memory management. Calling AllocMem can have a negative impact on performance, but with careful use, it can be a valuable tool.

Memory blocks allocated with AllocMem cannot be managed with the normal C run-time or Windows API memory management functions.

CHttpFilterContext OverviewClass MembersHierarchy Chart