private MemoryAllocators()
        {
            this.recyclableMemoryStreamManager = new RecyclableMemoryStreamManager();
            this.recyclableMemoryStreamManager.AggressiveBufferReturn = true;

            this.allocator = new FixedByteAllocator(1000, 10, 10);

            AllocatorInitializer initializer = new AllocatorInitializer();

            initializer.entries.Add((6, 18000));
            initializer.entries.Add((12, 8000));
            initializer.entries.Add((14, 8000));
            initializer.entries.Add((25, 6000));
            initializer.entries.Add((27, 6000));
            initializer.entries.Add((40, 6000));

            int blockPoolInitialCount = 15300;

            this.cryptoAllocator = new FixedByteAllocator(initializer, blockPoolInitialCount, 1000);

            initializer = new AllocatorInitializer();
            initializer.entries.Add((0, 100));
            initializer.entries.Add((1, 100));
            initializer.entries.Add((2, 100));
            initializer.entries.Add((3, 100));
            initializer.entries.Add((13, 100));
            initializer.entries.Add((26, 25));

            blockPoolInitialCount = 70;

            this.doubleArrayCryptoAllocator = new FixesdDoubleByteArrayAllocator(initializer, blockPoolInitialCount, 5);
        }
示例#2
0
        public FixedAllocator(AllocatorInitializer initializer, int blockPoolInitializeCount, int initialCounts = 100, int arraySizeIncrements = 100) : this(initialCounts, arraySizeIncrements)
        {
            foreach ((int index, int initialCount)entry in initializer.entries)
            {
                this.buffers[entry.index].Expand(entry.initialCount);
            }

            // ensure a proper inital count
            this.BlockPool.CreateMore(blockPoolInitializeCount);
        }
示例#3
0
 public FixesdDoubleByteArrayAllocator(AllocatorInitializer initializer, int blockPoolInitializeCount, int initialCounts = 100, int arraySizeIncrements = 5, int maxArraySize = SMALL_SIZE) : base(initializer, blockPoolInitializeCount, initialCounts, arraySizeIncrements)
 {
 }