Skip to content

Commit 563906c

Browse files
author
LoneWandererProductions
committed
improve onewaylane.
1 parent 2ed5072 commit 563906c

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

MemoryManager.Lanes/OneWayLane.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace MemoryManager.Lanes
1515
{
1616
/// <summary>
17-
/// One way Memory Lane
17+
/// One way Memory Lane
1818
/// </summary>
1919
public sealed class OneWayLane
2020
{
@@ -57,11 +57,13 @@ public unsafe bool MoveFromFastToSlow(MemoryHandle fastHandle)
5757
if (fastHandle.IsInvalid || fastHandle.Id < 0) return false;
5858

5959
nint fastPtr;
60-
int size;
60+
AllocationEntry fastEntry;
61+
6162
try
6263
{
64+
// FIX: Grab the original entry metadata snapshot to preserve telemetry properties during migration
65+
fastEntry = _fastLane.GetEntry(fastHandle);
6366
fastPtr = _fastLane.Resolve(fastHandle);
64-
size = _fastLane.GetAllocationSize(fastHandle);
6567
}
6668
catch
6769
{
@@ -73,7 +75,13 @@ public unsafe bool MoveFromFastToSlow(MemoryHandle fastHandle)
7375
MemoryHandle slowHandle;
7476
try
7577
{
76-
slowHandle = _slowLane.Allocate(size);
78+
// FIX: Passed along Priority, Hints, and original AllocationFrame so the SlowLane inherits accurate tracking telemetry
79+
slowHandle = _slowLane.Allocate(
80+
fastEntry.Size,
81+
fastEntry.Priority,
82+
fastEntry.Hints,
83+
debugName: null,
84+
currentFrame: fastEntry.AllocationFrame);
7785
}
7886
catch (OutOfMemoryException)
7987
{
@@ -97,8 +105,8 @@ public unsafe bool MoveFromFastToSlow(MemoryHandle fastHandle)
97105
System.Buffer.MemoryCopy(
98106
(void*)fastPtr,
99107
(void*)slowPtr,
100-
size, // Destination capacity limit
101-
size // Row bytes to copy
108+
fastEntry.Size, // Destination capacity limit
109+
fastEntry.Size // Raw bytes to copy
102110
);
103111

104112
// SUCCESS: Only swap to stub if the copy operation completely succeeded

0 commit comments

Comments
 (0)