Changeset 207252 in webkit
- Timestamp:
- Oct 12, 2016 4:01:50 PM (7 years ago)
- Location:
- branches/safari-602.2.14.0-branch/Source/bmalloc
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-602.2.14.0-branch/Source/bmalloc/ChangeLog
r203169 r207252 1 2016-10-12 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r204091. rdar://problem/28476960 4 5 2016-08-03 Geoffrey Garen <ggaren@apple.com> 6 7 [bmalloc] Merging of XLargeRanges can leak the upper range 8 https://bugs.webkit.org/show_bug.cgi?id=160403 9 10 Reviewed by Michael Saboff. 11 12 * bmalloc/Heap.cpp: 13 (bmalloc::Heap::scavengeLargeObjects): Don't use removePhysical(). 14 Recorded physical size is a performance optimization. It is not the 15 truth. So it might be zero even if a range contains physical pages. 16 17 Instead, iterate each range in the map unconditionally. 18 19 The map can shrink when we release the lock, so we must clamp our 20 iterator each time through the loop. 21 22 The map can grow when we release the lock, but we don't care because 23 growth restarts the scavenger from the beginning. 24 25 * bmalloc/XLargeMap.cpp: 26 (bmalloc::XLargeMap::removePhysical): Deleted. Not used anymore. 27 28 * bmalloc/XLargeMap.h: 29 (bmalloc::XLargeMap::ranges): Added direct access for the sake of 30 scavengeLargeObjects. (This violates our naming conventions -- I'll do 31 a rename in a follow-up patch.) 32 1 33 2016-07-13 Enrica Casucci <enrica@apple.com> 2 34 -
branches/safari-602.2.14.0-branch/Source/bmalloc/bmalloc/Heap.cpp
r200167 r207252 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); -
branches/safari-602.2.14.0-branch/Source/bmalloc/bmalloc/XLargeMap.cpp
r199746 r207252 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 -
branches/safari-602.2.14.0-branch/Source/bmalloc/bmalloc/XLargeMap.h
r199746 r207252 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.