CMemAllocator class

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

cmemallocator class hierarchy

Implements an allocator that supports the IMemAllocator interface.

This class derives from CBaseAllocator. For more information about allocators, refer to the documentation for CBaseAllocator.

Protected Member Variables Description
m_pBuffer Pointer to the memory block that contains the buffers.
Protected Methods Description
Free Placeholder method; called during a decommit operation.
ReallyFree Releases the memory for the buffers.
Alloc Allocates memory for the buffers.
Public Methods Description
CMemAllocator Constructor method.
~ CMemAllocator Destructor method.
CreateInstance Creates a new instance of the CMemAllocator class.
IMemAllocator Methods Description
SetProperties Specifies the number of buffers to allocate and the size of each buffer.

Requirements

Requirement Value
Header
Amfilter.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

Providing a Custom Allocator