|
|
|
@ -67,7 +67,7 @@ internal class SharedArrayPoolBuffer<T> : ManagedBufferBase<T>, IRefCounted |
|
|
|
|
|
|
|
private sealed class LifetimeGuard : RefCountedMemoryLifetimeGuard |
|
|
|
{ |
|
|
|
private byte[] array; |
|
|
|
private byte[]? array; |
|
|
|
|
|
|
|
public LifetimeGuard(byte[] array) => this.array = array; |
|
|
|
|
|
|
|
@ -78,7 +78,8 @@ internal class SharedArrayPoolBuffer<T> : ManagedBufferBase<T>, IRefCounted |
|
|
|
// This is not ideal, but subsequent leaks will end up returning arrays to per-cpu buckets,
|
|
|
|
// meaning likely a different bucket than it was rented from,
|
|
|
|
// but this is PROBABLY better than not returning the arrays at all.
|
|
|
|
ArrayPool<byte>.Shared.Return(this.array); |
|
|
|
ArrayPool<byte>.Shared.Return(this.array!); |
|
|
|
this.array = null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|