public BufferRef Allocate(byte bucketIndex, out bool fromFreeList, SharedMemoryBuckets buckets = null) { BufferRef.EnsureBucketIndexInRange(bucketIndex); using (var txn = _env.BeginTransaction()) { try { BufferRef freeRef = Allocate(txn, bucketIndex, out fromFreeList, buckets); txn.Commit(); // Without packing and returning buffers to pool this kills performance // But it must be done. if (!fromFreeList) { _env.Sync(true); } return(freeRef); } catch { txn.Abort(); throw; } } }