You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation for Memory<T>, IMemoryOwner<T> (#548)
* Initial checkin
* second check-in
* Documented Memory<T>
* Additional commit
* Incremental commit
* Added some detail
* Fixed malformed XML
* Fixed more malformed XML
* more malformed xml
* Incorporated reveiw comments
* Minor changes
* Addressed feedback, fixed invalid XML
* Added code, fixed bad xrefs
* Fixed broken links
* Corrected final bad xref
Copy file name to clipboardExpand all lines: xml/System.Buffers/IMemoryOwner`1.xml
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -22,14 +22,24 @@
22
22
</Interfaces>
23
23
<Docs>
24
24
<typeparamname="T">The type of elements to store in memory.</typeparam>
25
-
<summary>Defines the owner responsible for the lifetime management of a <seecref="System.Memory`1" /> buffer.</summary>
25
+
<summary>Identifies the owner of a block of memory who is responsible for disposing of the underlying memory appropriately. </summary>
26
26
<remarks>
27
-
<formattype="text/markdown"><![CDATA[
27
+
<formattype="text/markdown"><![CDATA[
28
28
29
-
The `IMemoryOwner<T>` interface defines the owner responsible for the lifetime management of a <xref:System.Memory%601> buffer, who is responsible for disposing of the underlying memory appropriately.
30
-
An instance of the `IMemoryOwner<T>` interface is returned by the <xref:System.Buffers.MemoryPool%601.Rent%2A?displayProperty=nameWithType> method.
29
+
The `IMemoryOwner<T>` interface is used to define the owner responsible for the lifetime management of a <xref:System.Memory%601> buffer. An instance of the `IMemoryOwner<T>` interface is returned by the <xef:System.Buffers.MemoryPool%601.Rent%2A?displayProperty=nameWithType> method.
30
+
31
+
While a buffer can have multiple consumers, it can only have a single owner at any given time. The owner can:
32
+
33
+
- Create the buffer either directly or by calling a factory method.
34
+
35
+
- Transfer ownership to another consumer. In this case, the previous owner should no longer use the buffer.
36
+
37
+
- Destroy the buffer when it is no longer in use.
38
+
39
+
Because the `IMemoryOwner<T>` object implements the <xref:System.IDisposable> interface, you should call its <xref:System.IDisposable.Dispose%2A> method only after the memory buffer is no longer needed and you have destroyed it. You should *not* dispose of the `IMemoryOnwer<T>` object while a reference to its memory is available. This means that the type in which `IMemoryOwner<T>` is declared should not have a <xref:System.Object.Finalize%2A> method.
40
+
41
+
]]></format>
31
42
32
-
]]></format>
33
43
</remarks>
34
44
</Docs>
35
45
<Members>
@@ -52,8 +62,8 @@ An instance of the `IMemoryOwner<T>` interface is returned by the <xref:System.B
52
62
<ReturnType>System.Memory<T></ReturnType>
53
63
</ReturnValue>
54
64
<Docs>
55
-
<summary>Gets the associated <seecref="System.Memory`1" /> buffer.</summary>
0 commit comments