public void Collect(KeyHeap.Page target, ulong sequence) { var current = (Key *)m_start; var end = (Key *)m_current; while (current < end) { bool keep = Key.StillAlive(current, sequence); if (keep) { // copy to the target page var moved = target.TryAppend(current); if (moved == null) { throw new InvalidOperationException("The target page was too small"); } var values = current->Values; if (values != null) { values->Parent = moved; } current->Header |= Entry.FLAGS_MOVED | Entry.FLAGS_DISPOSED; } else { current->Header |= Entry.FLAGS_DISPOSED; } current = Key.WalkNext(current); } }
public override void Debug_Dump(bool detailed) { Contract.Requires(m_start != null && m_current != null); Key *current = (Key *)m_start; Key *end = (Key *)m_current; Trace.WriteLine(" # KeyPage: count=" + m_count.ToString("N0") + ", used=" + this.MemoryUsage.ToString("N0") + ", capacity=" + m_capacity.ToString("N0") + ", start=0x" + new IntPtr(m_start).ToString("X8") + ", end=0x" + new IntPtr(m_current).ToString("X8")); if (detailed) { while (current < end) { Trace.WriteLine(" - [" + Entry.GetObjectType(current).ToString() + "] 0x" + new IntPtr(current).ToString("X8") + " : " + current->Header.ToString("X8") + ", size=" + current->Size + ", h=0x" + current->HashCode.ToString("X4") + " : " + FdbKey.Dump(Key.GetData(current).ToSlice())); var value = current->Values; while (value != null) { Trace.WriteLine(" -> [" + Entry.GetObjectType(value) + "] 0x" + new IntPtr(value).ToString("X8") + " @ " + value->Sequence + " : " + Value.GetData(value).ToSlice().ToAsciiOrHexaString()); value = value->Previous; } current = Key.WalkNext(current); } } }