RecyclableList.SetNewLength fixed to properly initialize the list if the no. of memory blocks from array pool exceeds requested no.
This commit is contained in:
1 parent
f231f7e0aa
commit
c7052e778f
2 files changed
+4
-3
No files matched your search
@@ -257,7 +257,7 @@ namespace Recyclable.Collections
|
|||||||
}
|
}
|
||||||
|
|
||||||
localInts[uninitializedBlocksCount] = newMemoryBlocksSpan.Length;
|
localInts[uninitializedBlocksCount] = newMemoryBlocksSpan.Length;
|
||||||
if (localInts[uninitializedBlocksCount] == localInts[requiredBlockCount])
|
if (localInts[uninitializedBlocksCount] >= localInts[requiredBlockCount])
|
||||||
{
|
{
|
||||||
if (minBlockSize >= RecyclableDefaults.MinPooledArrayLength)
|
if (minBlockSize >= RecyclableDefaults.MinPooledArrayLength)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ namespace Recyclable.CollectionsTests
|
|||||||
|
|
||||||
public static readonly IEnumerable<long> ItemsCountVariants = new long[]
|
public static readonly IEnumerable<long> ItemsCountVariants = new long[]
|
||||||
{
|
{
|
||||||
0, 1, 2, 3, 10, 16, 32, 64, 128, 256, 333, 512, 1_024, 8_192, 16_384
|
0, 1, 2, 3, 10, 16, 32, 64, 128, 256, 333, 512, 1_024, 8_192, 16_384,
|
||||||
|
1_000_000
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly IEnumerable<int> BlockSizeVariants = new int[]
|
public static readonly IEnumerable<int> BlockSizeVariants = new int[]
|
||||||
{
|
{
|
||||||
1, 2, 3, 10, 16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096,
|
1, 2, 4, 8, 10, 16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096,
|
||||||
8_192, 16_384
|
8_192, 16_384
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user