Ejemplo n.º 1
0
        private void ResizeDb()
        {
            var oldData    = _scratchMemory.Span;
            var newScratch = _pool.Rent(_scratchMemory.Length * 2);
            int dbLength   = newScratch.Length / 2;

            var newDb = newScratch.Memory.Slice(0, dbLength);

            _db.Slice(0, _valuesIndex).Span.CopyTo(newDb.Span);
            _db = newDb;

            var newStackMemory = newScratch.Memory.Slice(dbLength);

            _stack.Resize(newStackMemory);
            _scratchManager.Dispose();
            _scratchManager = newScratch;
        }
Ejemplo n.º 2
0
        private void ResizeDb()
        {
            var oldData    = _scratch.Span;
            var newScratch = _pool.Rent(_scratch.Length * 2);
            int dbLength   = newScratch.Length / 2;

            var newDb = newScratch.Slice(0, dbLength);

            _db.Slice(0, _valuesIndex).CopyTo(newDb);
            _db = newDb;

            var newStackMemory = newScratch.Slice(dbLength);

            _stack.Resize(newStackMemory);
            _pool.Return(_scratch);
            _scratch = newScratch;
        }