Share via


IMemoryBuffer Interface

Definition

Represents a reference counted memory buffer.

public interface class IMemoryBuffer : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(4223982890, 9307, 4580, 175, 152, 104, 148, 35, 38, 12, 248)]
struct IMemoryBuffer : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(4223982890, 9307, 4580, 175, 152, 104, 148, 35, 38, 12, 248)]
public interface IMemoryBuffer : System.IDisposable
Public Interface IMemoryBuffer
Implements IDisposable
Derived
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

IMemoryBuffer provides an interoperability protocol between the unmanaged, direct memory access of the native platform and the reference-counted, potentially garbage-collected environment hosting managed objects. The managed type system requires deterministic lifetime for all types. This lifetime is sometimes implicit (value types are copied by value) or explicit (reference types are reference counted). However for performance reasons, code occasionally needs to interact with types that don’t naturally fit into either model.

A common example, and the one addressed by the IMemoryBuffer design, is access to a direct pointer to a block of memory where performance constraints require that the memory is not copied. The IMemoryBuffer abstraction encapsulates such a direct memory pointer within a set of reference counted objects that layer explicit acquisition of the raw memory pointer and allow its deterministic release.

Methods

CreateReference()

Returns a new Windows Runtime object that implements the IMemoryBufferReference interface.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Applies to

See also