IMemAllocator interface (strmif.h)

The IMemAllocator interface allocates media samples, for moving data between pins.

This interface is used by pins that share allocators, when the input pin exposes the IMemInputPin interface. The pins negotiate which pin will provide the allocator. The allocator is used to allocate memory buffers, retrieve empty buffers, and release buffers. Not every filter creates its own allocator, so one allocator might be used by several filters. For more information, see How Filters Connect.

Applications typically do not use this interface.

To use an allocator, perform the following steps:

  1. Call the IMemAllocator::SetProperties method to specify the buffer requirements, including the number of buffers and the size of each buffer.
  2. Call the IMemAllocator::Commit method to allocate the buffers.
  3. Call the IMemAllocator::GetBuffer method to retrieve media samples. This method blocks until the next sample becomes available.
  4. When you are done with each sample, call the IUnknown::Release method on the sample. The sample is not deleted when its reference count reaches zero. Instead, the sample returns to the allocator's free list.
  5. When you are done using the allocator, call the IMemAllocator::Decommit method to release the memory for the buffers.


The IMemAllocator interface inherits from the IUnknown interface. IMemAllocator also has these types of members:


The IMemAllocator interface has these methods.


The Commit method allocates the buffer memory.

The Decommit method releases the buffer memory.

The GetBuffer method retrieves a media sample that contains an empty buffer.

The GetProperties method retrieves the number of buffers that the allocator will create, and the buffer properties.

The ReleaseBuffer method releases a media sample.

The SetProperties method specifies the number of buffers to allocate and the size of each buffer.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)