|
68 | 68 | <typeparam name="T">The type of the objects that are in the resource pool.</typeparam> |
69 | 69 | <summary>Provides a resource pool that enables reusing instances of type T[].</summary> |
70 | 70 | <remarks> |
71 | | - <format type="text/markdown"><![CDATA[ |
72 | | - |
73 | | -## Remarks |
74 | | - |
75 | | - Using the <xref:System.Buffers.ArrayPool%601> class to rent and return buffers (using the <xref:System.Buffers.ArrayPool%601.Rent%2A> and <xref:System.Buffers.ArrayPool%601.Return%2A> methods) can improve performance in situations where arrays are created and destroyed frequently, resulting in significant memory pressure on the garbage collector. |
76 | | - |
| 71 | + <format type="text/markdown"><![CDATA[ |
| 72 | +
|
| 73 | +## Remarks |
| 74 | +
|
| 75 | + Using the <xref:System.Buffers.ArrayPool`1> class to rent and return buffers (using the <xref:System.Buffers.ArrayPool`1.Rent*> and <xref:System.Buffers.ArrayPool`1.Return*> methods) can improve performance in situations where arrays are created and destroyed frequently, resulting in significant memory pressure on the garbage collector. |
| 76 | +
|
77 | 77 | ]]></format> |
78 | 78 | </remarks> |
79 | 79 | <threadsafe>This class is thread-safe. All members may be used by multiple threads concurrently.</threadsafe> |
|
113 | 113 | <Docs> |
114 | 114 | <summary>Initializes a new instance of the <see cref="T:System.Buffers.ArrayPool`1" /> class.</summary> |
115 | 115 | <remarks> |
116 | | - <format type="text/markdown"><![CDATA[ |
117 | | - |
118 | | -## Remarks |
119 | | - |
120 | | -Note that this constructor is protected; it can only be called by classes derived from the <xref:System.Buffers.ArrayPool%601> class. |
| 116 | + <format type="text/markdown"><![CDATA[ |
| 117 | +
|
| 118 | +## Remarks |
| 119 | +
|
| 120 | +Note that this constructor is protected; it can only be called by classes derived from the <xref:System.Buffers.ArrayPool`1> class. |
121 | 121 | ]]></format> |
122 | 122 | </remarks> |
123 | 123 | </Docs> |
@@ -208,11 +208,11 @@ Note that this constructor is protected; it can only be called by classes derive |
208 | 208 | <summary>Creates a new instance of the <see cref="T:System.Buffers.ArrayPool`1" /> class using the specified configuration.</summary> |
209 | 209 | <returns>A new instance of the <see cref="T:System.Buffers.ArrayPool`1" /> class with the specified configuration.</returns> |
210 | 210 | <remarks> |
211 | | - <format type="text/markdown"><![CDATA[ |
212 | | - |
213 | | -## Remarks |
214 | | - |
215 | | -The instance of the <xref:System.Buffers.ArrayPool%601> class created by this method will group arrays into buckets, with no more than `maxArraysPerBucket` in each bucket, and with those arrays not exceeding `maxArrayLength` in length. |
| 211 | + <format type="text/markdown"><![CDATA[ |
| 212 | +
|
| 213 | +## Remarks |
| 214 | +
|
| 215 | +The instance of the <xref:System.Buffers.ArrayPool`1> class created by this method will group arrays into buckets, with no more than `maxArraysPerBucket` in each bucket, and with those arrays not exceeding `maxArrayLength` in length. |
216 | 216 | ]]></format> |
217 | 217 | </remarks> |
218 | 218 | </Docs> |
@@ -259,13 +259,13 @@ The instance of the <xref:System.Buffers.ArrayPool%601> class created by this me |
259 | 259 | <summary>Retrieves a buffer that is at least the requested length.</summary> |
260 | 260 | <returns>An array of type T that is at least <paramref name="minimumLength" /> in length.</returns> |
261 | 261 | <remarks> |
262 | | - <format type="text/markdown"><![CDATA[ |
263 | | - |
264 | | -## Remarks |
| 262 | + <format type="text/markdown"><![CDATA[ |
| 263 | +
|
| 264 | +## Remarks |
265 | 265 |
|
266 | | -This buffer is loaned to the caller and should be returned to the same pool using the <xref:System.Buffers.ArrayPool%601.Return%2A> method, so that it can be reused in subsequent calls to the <xref:System.Buffers.ArrayPool%601.Rent%2A> method. Failure to return a rented buffer is not a fatal error. However, it may lead to decreased application performance, as the pool may need to create a new buffer to replace the lost one. |
| 266 | +This buffer is loaned to the caller and should be returned to the same pool using the <xref:System.Buffers.ArrayPool`1.Return*> method, so that it can be reused in subsequent calls to the <xref:System.Buffers.ArrayPool`1.Rent*> method. Failure to return a rented buffer is not a fatal error. However, it may lead to decreased application performance, as the pool may need to create a new buffer to replace the lost one. |
267 | 267 |
|
268 | | -The array returned by this method may not be zero-initialized. |
| 268 | +The array returned by this method may not be zero-initialized. |
269 | 269 | ]]></format> |
270 | 270 | </remarks> |
271 | 271 | </Docs> |
@@ -312,11 +312,11 @@ The array returned by this method may not be zero-initialized. |
312 | 312 | <param name="clearArray">Indicates whether the contents of the buffer should be cleared before reuse. If <paramref name="clearArray" /> is set to <see langword="true" />, and if the pool will store the buffer to enable subsequent reuse, the <see cref="M:System.Buffers.ArrayPool`1.Return(`0[],System.Boolean)" /> method will clear the <paramref name="array" /> of its contents so that a subsequent caller using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)" /> method will not see the content of the previous caller. If <paramref name="clearArray" /> is set to <see langword="false" /> or if the pool will release the buffer, the array's contents are left unchanged.</param> |
313 | 313 | <summary>Returns an array to the pool that was previously obtained using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)" /> method on the same <see cref="T:System.Buffers.ArrayPool`1" /> instance.</summary> |
314 | 314 | <remarks> |
315 | | - <format type="text/markdown"><![CDATA[ |
316 | | - |
317 | | -## Remarks |
| 315 | + <format type="text/markdown"><![CDATA[ |
318 | 316 |
|
319 | | -Once a buffer has been returned to the pool, the caller gives up all ownership of the buffer and must not use it. The reference returned from a given call to the <xref:System.Buffers.ArrayPool%601.Rent%2A> method must only be returned using the <xref:System.Buffers.ArrayPool%601.Return%2A> method once. The default <xref:System.Buffers.ArrayPool%601> may hold onto the returned buffer in order to rent it again, or it may release the returned buffer if it's determined that the pool already has enough buffers stored. |
| 317 | +## Remarks |
| 318 | +
|
| 319 | +Once a buffer has been returned to the pool, the caller gives up all ownership of the buffer and must not use it. The reference returned from a given call to the <xref:System.Buffers.ArrayPool`1.Rent*> method must only be returned using the <xref:System.Buffers.ArrayPool`1.Return*> method once. The default <xref:System.Buffers.ArrayPool`1> may hold onto the returned buffer in order to rent it again, or it may release the returned buffer if it's determined that the pool already has enough buffers stored. |
320 | 320 |
|
321 | 321 | > [!IMPORTANT] |
322 | 322 | > Returning the same array reference twice or continuing to use the array reference after it has been returned is a high-severity security issue. These actions can lead to [double-free](https://cwe.mitre.org/data/definitions/415.html) and [use-after-free](https://cwe.mitre.org/data/definitions/416.html) vulnerabilities, which might result in data corruption, data leaks, and denial of service. |
@@ -362,11 +362,11 @@ Once a buffer has been returned to the pool, the caller gives up all ownership o |
362 | 362 | <summary>Gets a shared <see cref="T:System.Buffers.ArrayPool`1" /> instance.</summary> |
363 | 363 | <value>A shared <see cref="T:System.Buffers.ArrayPool`1" /> instance.</value> |
364 | 364 | <remarks> |
365 | | - <format type="text/markdown"><![CDATA[ |
366 | | - |
367 | | -## Remarks |
| 365 | + <format type="text/markdown"><![CDATA[ |
| 366 | +
|
| 367 | +## Remarks |
368 | 368 |
|
369 | | -The shared pool provides a default implementation of the <xref:System.Buffers.ArrayPool%601> class that's intended for general applicability. A shared class maintains arrays of multiple sizes, and may hand back a larger array than was actually requested, but it will never hand back a smaller array than was requested. Renting a buffer from a shared class using the <xref:System.Buffers.ArrayPool%601.Rent%2A> method will result in an existing buffer being taken from the pool if an appropriate buffer is available or in a new buffer being allocated if one is not available. |
| 369 | +The shared pool provides a default implementation of the <xref:System.Buffers.ArrayPool`1> class that's intended for general applicability. A shared class maintains arrays of multiple sizes, and may hand back a larger array than was actually requested, but it will never hand back a smaller array than was requested. Renting a buffer from a shared class using the <xref:System.Buffers.ArrayPool`1.Rent*> method will result in an existing buffer being taken from the pool if an appropriate buffer is available or in a new buffer being allocated if one is not available. |
370 | 370 | ]]></format> |
371 | 371 | </remarks> |
372 | 372 | </Docs> |
|
0 commit comments