Changeset 196186 in webkit
- Timestamp:
- Feb 5, 2016, 1:34:27 PM (10 years ago)
- Location:
- trunk/Source/bmalloc
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/bmalloc/ChangeLog
r195942 r196186 1 2016-02-05 Saam barati <sbarati@apple.com> 2 3 bmalloc: largeMax calculation is wrong on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=153923 5 6 Reviewed by Mark Lam. 7 8 Our number for largeMax was larger than what we had 9 space to actually allocate inside the LargeChunk. This made 10 it so that we would allocate a large object for something 11 that really should be extra large. Previously: 12 largeMax + sizeof(LargeChunk) > 1MB 13 which meant that when we would grow() to accommodate an allocation 14 of a particular size inside a LargeObject despite the fact that 15 the allocation size would be too large to actually fit in the LargeObject. 16 This would manifest when we had an allocation size in the range: 17 1MB - sizeof(LargeChunk) < allocation size < largeMax 18 19 We fix this bug by being precise in our calculation of largeMax 20 instead of just assuming largeChunkSize * 99/100 is enough 21 space for the metadata. 22 23 * bmalloc/LargeChunk.h: 24 (bmalloc::LargeChunk::get): 25 * bmalloc/Sizes.h: 26 1 27 2016-01-31 Dan Bernstein <mitz@apple.com> 2 28 -
trunk/Source/bmalloc/bmalloc/LargeChunk.h
r180037 r196186 79 79 }; 80 80 81 static_assert(largeChunkMetadataSize == sizeof(LargeChunk), "'largeChunkMetadataSize' should be the same number as sizeof(LargeChunk) or our computation in Sizes.h for 'largeMax' is wrong"); 82 static_assert(largeChunkMetadataSize + largeMax <= largeChunkSize, "We will think we can accommodate larger objects than we can in reality"); 83 81 84 inline LargeChunk* LargeChunk::get(void* object) 82 85 { -
trunk/Source/bmalloc/bmalloc/Sizes.h
r193373 r196186 73 73 74 74 static const size_t largeChunkSize = superChunkSize / 2; 75 #if BPLATFORM(IOS) 76 static const size_t largeChunkMetadataSize = 16 * kB; 77 #else 78 static const size_t largeChunkMetadataSize = 4 * kB; 79 #endif 75 80 static const size_t largeChunkOffset = 0; 76 81 static const size_t largeChunkMask = ~(largeChunkSize - 1ul); 77 82 78 83 static const size_t largeAlignment = 64; 79 static const size_t largeMax = largeChunkSize * 99 / 100; // Plenty of room for metadata.84 static const size_t largeMax = largeChunkSize - largeChunkMetadataSize; 80 85 static const size_t largeMin = mediumMax; 81 86 -
trunk/Source/bmalloc/bmalloc/VMHeap.cpp
r180960 r196186 54 54 55 55 LargeChunk* largeChunk = superChunk->largeChunk(); 56 m_largeObjects.insert(LargeObject(LargeObject::init(largeChunk).begin())); 56 LargeObject result(LargeObject::init(largeChunk).begin()); 57 BASSERT(result.size() == largeMax); 58 m_largeObjects.insert(result); 57 59 } 58 60
Note:
See TracChangeset
for help on using the changeset viewer.