Skip to content

Commit 79df937

Browse files
committed
In case of netstandard 2.0, improved ArrayPool usage.
Instead of manually clearing the rented array before returning it back to the pool, added clearArray: true argument for the Return() call.
1 parent de3930f commit 79df937

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/ByteAether.Ulid/Ulid.New.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ private static void FillRandom(Span<byte> bytes, bool isMonotonic)
167167
_rng.GetBytes(random, 0, _ulidSizeRandom);
168168
new ReadOnlySpan<byte>(random, 0, _ulidSizeRandom).CopyTo(bytes[_ulidSizeTime..]);
169169

170-
Array.Clear(random, 0, _ulidSizeRandom);
171-
ArrayPool<byte>.Shared.Return(random);
170+
ArrayPool<byte>.Shared.Return(random, true);
172171
#endif
173172
return;
174173
}

0 commit comments

Comments
 (0)