going on reconstruct of HLSF
This commit is contained in:
@@ -30,7 +30,6 @@ using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using hlsfHandle = StgSharp.HighPerformance.Memory.HlsfHandle;
|
||||
|
||||
namespace StgSharp.HighPerformance.Memory
|
||||
{
|
||||
@@ -38,15 +37,16 @@ namespace StgSharp.HighPerformance.Memory
|
||||
{
|
||||
|
||||
// Bucket system field - directly in main allocator class
|
||||
private readonly BucketNode *[] _bucketHeads;
|
||||
private readonly BucketNode*[] _bucketHeads;
|
||||
|
||||
// _spareMemory is also the beginning position of allocator
|
||||
private Entry *_spareMemory;
|
||||
private Entry* _spareMemory;
|
||||
private readonly byte* m_Buffer;
|
||||
|
||||
private readonly Action<nuint> _freeHandle;
|
||||
private bool disposedValue;
|
||||
private readonly int _align;
|
||||
private readonly int _maxLevel;
|
||||
private readonly nuint _maxAllocSize;
|
||||
private readonly nuint _size;
|
||||
private readonly SlabAllocator<Entry> _entries;
|
||||
@@ -88,16 +88,8 @@ namespace StgSharp.HighPerformance.Memory
|
||||
_spareMemory->Position = (nuint)m_Buffer;
|
||||
_spareMemory->Size = byteSize;
|
||||
|
||||
int levelCountOrigin = _levelSizeArray.Length;
|
||||
int levelCount = GetLevelFromSize(maxBlockSize) + 1;
|
||||
Array.Resize(ref _levelSizeArray, levelCount);
|
||||
_bucketHeads = new BucketNode*[(levelCount * 3) + 1];
|
||||
uint size = _levelSizeArray[^1];
|
||||
for (int i = levelCountOrigin; i < levelCount; i++)
|
||||
{
|
||||
size *= 4;
|
||||
_levelSizeArray[i] = size;
|
||||
}
|
||||
_maxLevel = GetLevelFromSize(maxBlockSize) + 1;
|
||||
_bucketHeads = new BucketNode*[(_maxLevel * 3) + 1];
|
||||
_maxAllocSize = maxBlockSize;
|
||||
_freeHandle = freeHandle ?? (static _ => { });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user