/// <summary> /// Flushes this service. /// </summary> public unsafe void Commit(Allocator allocator, JournalLog log) { freedData.Sort(); allocData.Sort(); // Upon dispose, we execute. log.RunTransaction(context.HintBlock, allocData, freedData, blocksWritten); // We can also return data to allocator. context.Dispose(); // Signal memory freed. allocator.MemoryFreed(freedData); }
/// <summary> /// Flushes this service. /// </summary> public unsafe void Dispose(Allocator allocator) { // Must sort it anyway. freedData.Sort(); List <ulong> allocs = new List <ulong>(freedData.Count + allocData.Count); allocs.AddRange(freedData); allocs.AddRange(allocData); // We sort allocations and frees. allocs.Sort(); JournalLog.WriteAllocationsDeallocs(provider, allocs); // We also end the context. context.Dispose(); // Return freed blocks. allocator.MemoryFreed(freedData); }