IMemoryBuffer IMemoryBuffer IMemoryBuffer IMemoryBuffer Interface

Definition

Represents a reference counted memory buffer.

public : interface IMemoryBufferpublic interface IMemoryBufferPublic Interface IMemoryBuffer// You can use this interface in JavaScript.
Inheritance
IClosableIDisposableIDisposableIDisposable
IMemoryBufferIMemoryBufferIMemoryBufferIMemoryBuffer
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

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() CreateReference() CreateReference() CreateReference()

Returns a new managed object that implements the IMemoryBufferReference interface.

public : IMemoryBufferReference CreateReference()public IMemoryBufferReference CreateReference()Public Function CreateReference() As IMemoryBufferReference// You can use this method in JavaScript.
Returns

Remarks

This method always successfully returns a new IMemoryBufferReference object even after the IMemoryBuffer has been closed. In that case, the returned IMemoryBufferReference is already closed. Therefore, the IMemoryBufferReference instance's Capacity property will be zero and IMemoryBufferByteAccess::GetBuffer method will always return a null memory pointer and zero capacity.

See Also

  • IClosable IDisposable IDisposable IDisposable