Microsoft Windows CE 3.0  

CMemAllocator Class

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This class provides support for IMemAllocatorby using the newoperator to allocate memory. Derived from CBaseAllocator, it overrides the CBaseAllocator::Allocmember function to allocate a single block of memory large enough to hold all the requested data areas, and then allocates (using the newoperator) a CMediaSampleobject for each requested buffer pointing into the data area.

The CBaseInputPinand CBaseOutputPinclasses instantiate CMemAllocatorobjects as the default allocator if no other suitable allocator is provided.

All member functions in this class that return HRESULTand accept a pointer as a parameter return E_POINTER when passed a null pointer.

Member Functions

Alloc Allocates memory for a media sample (overrides CBaseAllocator::Alloc).
CMemAllocator Constructs a CMemAllocatorobject.
ReallyFree Frees memory when called from the destructor (or from Allocwhen reallocating for new size or count).

Overridable Member Functions

Free Indicates an overridden CBaseAllocator::Freemember function, called when a decommit operation is complete to free memory.

Implemented IMemAllocator Methods

CreateInstance Creates new instances of CMemAllocator in the factory template.
SetProperties Sets the number of media samples and the size of each.