Index: compiler-rt/lib/scudo/standalone/primary64.h =================================================================== --- compiler-rt/lib/scudo/standalone/primary64.h +++ compiler-rt/lib/scudo/standalone/primary64.h @@ -132,6 +132,10 @@ else Region->TryReleaseThreshold = PageSize; Region->ReleaseInfo.LastReleaseAtNs = Time; + + Region->MemMap = ReservedMemory.dispatch( + PrimaryBase + (I << Config::Primary::RegionSizeLog), RegionSize); + CHECK(Region->MemMap.isAllocated()); } shuffle(RegionInfoArray, NumClasses, &Seed); @@ -754,12 +758,6 @@ Region->Exhausted = true; return false; } - // TODO: Consider allocating MemMap in init(). - if (!Region->MemMap.isAllocated()) { - Region->MemMap = ReservedMemory.dispatch( - getRegionBaseByClassId(ClassId), RegionSize); - } - DCHECK(Region->MemMap.isAllocated()); if (UNLIKELY(!Region->MemMap.remap( RegionBeg + MappedUser, MapSize, "scudo:primary",