IMemAllocator::Decommit

 
Microsoft DirectShow 9.0

IMemAllocator::Decommit

The Decommit method releases the buffer memory.

Syntax

  HRESULT Decommit(void);

Return Values

Returns S_OK if successful, or an HRESULT value indicating the cause of the error.

Remarks

Any threads waiting in the IMemAllocator::GetBuffer method return with an error. Further calls to GetBuffer fail, until the IMemAllocator::Commit method is called.

The purpose of the Decommit method is to prevent filters from getting any more samples from the allocator. Filters that already hold a reference count on a sample are not affected. After a filter releases a sample and the reference count goes to zero,  however, the sample is no longer available.

The allocator may free the memory belonging to any sample with a reference count of zero. Thus, the Decommit method "releases" the memory in the sense that filters stop having access to it. Whether the memory actually returns to the heap depends on the implementation of the allocator. Some allocators wait until their own destructor method. However, an allocator must not leave any allocated memory behind when it deletes itself. Therefore, an allocator's destructor must wait until all of its samples are released.

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also