private int Initialize(int capacity) { var size = HashHelpers.GetPrime(capacity); var buckets = new SegmentedList <int>(defaultSegmentSize, size); var entries = new SegmentedList <Entry>(defaultSegmentSize, size); // Assign member variables after both arrays allocated to guard against corruption from OOM if second fails _freeList = -1; _fastModMultiplier = HashHelpers.GetFastModMultiplier((uint)buckets.Capacity); _buckets = buckets; _entries = entries; return(size); }