Title: [173524] trunk/Source/bmalloc
- Revision
- 173524
- Author
- [email protected]
- Date
- 2014-09-11 12:05:38 -0700 (Thu, 11 Sep 2014)
Log Message
bmalloc: eager scavenge leaves behind a bogus allocator
https://bugs.webkit.org/show_bug.cgi?id=136743
Reviewed by Sam Weinig.
Be sure to clear the allocator after logging it in the eager scavenge
case, so that we don't later try to allocate out of the lines that we
have thrown away.
We didn't need to do this previously because scavenge would only happen
at thread exit time, after which no further allocation from the per-thread
cache would take place.
* bmalloc/Allocator.cpp:
(bmalloc::Allocator::scavenge):
* bmalloc/MediumAllocator.h:
(bmalloc::MediumAllocator::clear):
* bmalloc/SmallAllocator.h:
(bmalloc::SmallAllocator::clear):
Modified Paths
Diff
Modified: trunk/Source/bmalloc/ChangeLog (173523 => 173524)
--- trunk/Source/bmalloc/ChangeLog 2014-09-11 18:48:21 UTC (rev 173523)
+++ trunk/Source/bmalloc/ChangeLog 2014-09-11 19:05:38 UTC (rev 173524)
@@ -1,3 +1,25 @@
+2014-09-11 Geoffrey Garen <[email protected]>
+
+ bmalloc: eager scavenge leaves behind a bogus allocator
+ https://bugs.webkit.org/show_bug.cgi?id=136743
+
+ Reviewed by Sam Weinig.
+
+ Be sure to clear the allocator after logging it in the eager scavenge
+ case, so that we don't later try to allocate out of the lines that we
+ have thrown away.
+
+ We didn't need to do this previously because scavenge would only happen
+ at thread exit time, after which no further allocation from the per-thread
+ cache would take place.
+
+ * bmalloc/Allocator.cpp:
+ (bmalloc::Allocator::scavenge):
+ * bmalloc/MediumAllocator.h:
+ (bmalloc::MediumAllocator::clear):
+ * bmalloc/SmallAllocator.h:
+ (bmalloc::SmallAllocator::clear):
+
2014-09-05 Geoffrey Garen <[email protected]>
bmalloc should honor the FastMalloc statistics API
Modified: trunk/Source/bmalloc/bmalloc/Allocator.cpp (173523 => 173524)
--- trunk/Source/bmalloc/bmalloc/Allocator.cpp 2014-09-11 18:48:21 UTC (rev 173523)
+++ trunk/Source/bmalloc/bmalloc/Allocator.cpp 2014-09-11 19:05:38 UTC (rev 173524)
@@ -56,11 +56,14 @@
void Allocator::scavenge()
{
- for (auto& allocator : m_smallAllocators)
+ for (auto& allocator : m_smallAllocators) {
log(allocator);
+ allocator.clear();
+ }
processSmallAllocatorLog();
log(m_mediumAllocator);
+ m_mediumAllocator.clear();
processMediumAllocatorLog();
}
Modified: trunk/Source/bmalloc/bmalloc/MediumAllocator.h (173523 => 173524)
--- trunk/Source/bmalloc/bmalloc/MediumAllocator.h 2014-09-11 18:48:21 UTC (rev 173523)
+++ trunk/Source/bmalloc/bmalloc/MediumAllocator.h 2014-09-11 19:05:38 UTC (rev 173524)
@@ -45,7 +45,9 @@
bool allocate(size_t, void*&);
unsigned char derefCount();
+
void refill(MediumLine*);
+ void clear();
private:
char* m_end;
@@ -101,6 +103,13 @@
m_objectCount = 0;
}
+inline void MediumAllocator::clear()
+{
+ m_end = nullptr;
+ m_remaining = 0;
+ m_objectCount = 0;
+}
+
} // namespace bmalloc
#endif // MediumAllocator_h
Modified: trunk/Source/bmalloc/bmalloc/SmallAllocator.h (173523 => 173524)
--- trunk/Source/bmalloc/bmalloc/SmallAllocator.h 2014-09-11 18:48:21 UTC (rev 173523)
+++ trunk/Source/bmalloc/bmalloc/SmallAllocator.h 2014-09-11 19:05:38 UTC (rev 173524)
@@ -47,7 +47,9 @@
unsigned short objectCount();
unsigned char derefCount();
+
void refill(SmallLine*);
+ void clear();
private:
char* m_ptr;
@@ -107,6 +109,12 @@
m_remaining = m_maxObjectCount;
}
+inline void SmallAllocator::clear()
+{
+ m_ptr = nullptr;
+ m_remaining = 0;
+}
+
} // namespace bmalloc
#endif // SmallAllocator_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes