Skip to content

Commit f93b21f

Browse files
Test reliance on previous over-allocating behavior, possible OOB. Various RecordInfo issues remain
1 parent ba9dd5d commit f93b21f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libs/storage/Tsavorite/cs/src/core/Utilities/SectorAlignedMemoryPool.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ public static SectorAlignedMemory Allocate(int byteCount, uint alignment)
185185
/// <returns>Returns a pool owned SectorAlignedMemory instance wrapping the allocated memory.</returns>
186186
internal static SectorAlignedMemory Allocate(int byteCount, uint alignment, SectorAlignedMemoryPool pool, int level)
187187
{
188-
var memoryPtr = (byte*)NativeMemory.AlignedAlloc((uint)byteCount, alignment);
189-
NativeMemory.Clear(memoryPtr, (uint)byteCount);
188+
var memoryPtr = (byte*)NativeMemory.AlignedAlloc((uint)byteCount + alignment, alignment);
189+
NativeMemory.Clear(memoryPtr, (uint)byteCount + alignment);
190190
GC.AddMemoryPressure(byteCount);
191191
return new SectorAlignedMemory(memoryPtr, byteCount, pool, level);
192192
}

0 commit comments

Comments
 (0)