Skip to content

Commit

Permalink
Updated way to pin pooled memory
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Oct 4, 2019
1 parent 127e908 commit 6dc7af6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cs/src/core/Index/FasterLog/FasterLogIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ public unsafe bool GetNext(MemoryPool<byte> pool, out IMemoryOwner<byte> entry,
if (GetNextInternal(out long physicalAddress, out entryLength, out bool epochTaken))
{
entry = pool.Rent(entryLength);
using (var handle = entry.Memory.Pin())
Buffer.MemoryCopy((void*)(4 + physicalAddress), handle.Pointer, entryLength, entryLength);

fixed (byte* bp = &entry.Memory.Span.GetPinnableReference())
Buffer.MemoryCopy((void*)(4 + physicalAddress), bp, entryLength, entryLength);

if (epochTaken)
epoch.Suspend();
Expand Down

0 comments on commit 6dc7af6

Please sign in to comment.