Changeset 204091 in webkit
- Timestamp:
- Aug 3, 2016 11:43:15 AM (8 years ago)
- Location:
- trunk/Source/bmalloc
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/bmalloc/ChangeLog
r203169 r204091 1 2016-08-03 Geoffrey Garen <ggaren@apple.com> 2 3 [bmalloc] Merging of XLargeRanges can leak the upper range 4 https://bugs.webkit.org/show_bug.cgi?id=160403 5 6 Reviewed by Michael Saboff. 7 8 * bmalloc/Heap.cpp: 9 (bmalloc::Heap::scavengeLargeObjects): Don't use removePhysical(). 10 Recorded physical size is a performance optimization. It is not the 11 truth. So it might be zero even if a range contains physical pages. 12 13 Instead, iterate each range in the map unconditionally. 14 15 The map can shrink when we release the lock, so we must clamp our 16 iterator each time through the loop. 17 18 The map can grow when we release the lock, but we don't care because 19 growth restarts the scavenger from the beginning. 20 21 * bmalloc/XLargeMap.cpp: 22 (bmalloc::XLargeMap::removePhysical): Deleted. Not used anymore. 23 24 * bmalloc/XLargeMap.h: 25 (bmalloc::XLargeMap::ranges): Added direct access for the sake of 26 scavengeLargeObjects. (This violates our naming conventions -- I'll do 27 a rename in a follow-up patch.) 28 1 29 2016-07-13 Enrica Casucci <enrica@apple.com> 2 30 -
trunk/Source/bmalloc/bmalloc/Heap.cpp
r200167 r204091 132 132 void Heap::scavengeLargeObjects(std::unique_lock<StaticMutex>& lock, std::chrono::milliseconds sleepDuration) 133 133 { 134 while (XLargeRange range = m_largeFree.removePhysical()) { 134 auto& ranges = m_largeFree.ranges(); 135 for (size_t i = ranges.size(); i-- > 0; i = std::min(i, ranges.size())) { 136 auto range = ranges.pop(i); 137 135 138 lock.unlock(); 136 139 vmDeallocatePhysicalPagesSloppy(range.begin(), range.size()); 137 140 lock.lock(); 138 141 139 142 range.setPhysicalSize(0); 140 m_largeFree.add(range);143 ranges.push(range); 141 144 142 145 waitUntilFalse(lock, sleepDuration, m_isAllocatingPages); -
trunk/Source/bmalloc/bmalloc/XLargeMap.cpp
r199746 r204091 77 77 } 78 78 79 XLargeRange XLargeMap::removePhysical()80 {81 auto it = std::find_if(m_free.begin(), m_free.end(), [](const XLargeRange& range) {82 return range.physicalSize();83 });84 85 if (it == m_free.end())86 return XLargeRange();87 88 return m_free.pop(it);89 }90 91 79 } // namespace bmalloc -
trunk/Source/bmalloc/bmalloc/XLargeMap.h
r199746 r204091 37 37 void add(const XLargeRange&); 38 38 XLargeRange remove(size_t alignment, size_t); 39 XLargeRange removePhysical();39 Vector<XLargeRange>& ranges() { return m_free; } 40 40 41 41 private:
Note: See TracChangeset
for help on using the changeset viewer.