dangerous release (possibly memory leak and deadlock)
This commit is contained in:
parent
a1cb6592eb
commit
741d34a5e0
10 changed files with 164 additions and 115 deletions
|
|
@ -7,10 +7,11 @@ public class ArrayOwner<T> : IBuffer<T> where T : unmanaged
|
|||
private readonly ArrayPool<T> _owner;
|
||||
private readonly T[] _buffer;
|
||||
|
||||
public ArrayOwner(ArrayPool<T> owner, int size)
|
||||
public ArrayOwner(ArrayPool<T> owner, int length)
|
||||
{
|
||||
_owner = owner;
|
||||
_buffer = owner.Rent(size);
|
||||
_buffer = owner.Rent(length);
|
||||
Length = length;
|
||||
}
|
||||
|
||||
~ArrayOwner() => Dispose();
|
||||
|
|
@ -26,4 +27,6 @@ public class ArrayOwner<T> : IBuffer<T> where T : unmanaged
|
|||
public Span<T> Span => _buffer;
|
||||
|
||||
public T[] Array => _buffer;
|
||||
|
||||
public int Length { get; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue