Skip to content

Commit d162f97

Browse files
author
Ron Petrusha
authored
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
1 parent 82ba281 commit d162f97

File tree

3 files changed

+225
-70
lines changed

3 files changed

+225
-70
lines changed

xml/System.Buffers/IMemoryOwner`1.xml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,24 @@
2222
</Interfaces>
2323
<Docs>
2424
<typeparam name="T">The type of elements to store in memory.</typeparam>
25-
<summary>Defines the owner responsible for the lifetime management of a <see cref="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>
2626
<remarks>
27-
<format type="text/markdown"><![CDATA[
27+
<format type="text/markdown"><![CDATA[
2828
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>
3142

32-
]]></format>
3343
</remarks>
3444
</Docs>
3545
<Members>
@@ -52,8 +62,8 @@ An instance of the `IMemoryOwner<T>` interface is returned by the <xref:System.B
5262
<ReturnType>System.Memory&lt;T&gt;</ReturnType>
5363
</ReturnValue>
5464
<Docs>
55-
<summary>Gets the associated <see cref="System.Memory`1" /> buffer.</summary>
56-
<value>The associated <see cref="System.Memory`1" /> buffer.</value>
65+
<summary>Gets the memory belonging to this owner.</summary>
66+
<value>The memory belonging to this owner.</value>
5767
<remarks>To be added.</remarks>
5868
</Docs>
5969
</Member>

0 commit comments

Comments
 (0)