Exemplo n.º 1
0
        public unsafe void Test()
        {
            const ulong nThreads = 4;
            const ulong offset   = 0;
            const ulong count    = 15000000;

            for (var loop = 0; loop < 20; loop++)
            {
                using (var keys = GenerateKeys(nThreads * count))
                {
                    Console.WriteLine("Generated " + count * nThreads);
                    using (var map = new ConcurrentHashmapOfKeys(_pool))
                    {
                        MultiThread(InsertAndReadAction, map, keys, (int)nThreads, count, offset);
                        //MultiThread(ReadAction, map, keys, (int) nThreads, count, offset);
                        //Console.WriteLine("Inserted " + count * nThreads);
                    }

                    //TestPersistence(count, keys);

                    Console.WriteLine("Completed test");
                }

                //_pool.Recycle();
                //_pool.DeallocateGarbage();
                Console.WriteLine("Deallocated garbage");
            }

            Console.WriteLine("Disposed keys");
            //Console.ReadLine();
            Console.WriteLine("Disposed map");
            //Console.ReadLine();

            _pool.DeallocateGarbage();
            Console.WriteLine("Deallocated garbage");
            Console.ReadLine();

            //_pool.Recycle();
            //Console.WriteLine("Recycled pool");
            //Console.ReadLine();
            _pool.Dispose();
            Console.WriteLine("Disposed pool");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        public void Compact(CompactionOptions options)
        {
            if (options == CompactionOptions.PurgeDeleted)
            {
                m_memoryPool.DeallocateGarbage();
            }
            else if (options == CompactionOptions.FullReindex)
            {
                RebuildUnmanagedData();

                foreach (var c in m_documentDataContainers)
                {
                    c.Value.SortIndexManager.InvalidateAllIndexes();
                }
            }
            else
            {
                throw new ArgumentException("Compaction mode not supported yet: " + options);
            }
        }