- Revision
- 173908
- Author
- gga...@apple.com
- Date
- 2014-09-23 22:07:19 -0700 (Tue, 23 Sep 2014)
Log Message
2014-09-23 Geoffrey Garen <gga...@apple.com>
Rolled out r173346.
bmalloc should honor the FastMalloc statistics API
https://bugs.webkit.org/show_bug.cgi?id=136592
This didn't really work. Because we allow ranges with and without
physical pages to merge, and we allow double-committing and
double-decommitting, we can't rely on commit actions to track memory
footprint.
* bmalloc/Heap.cpp:
(bmalloc::Heap::size): Deleted.
(bmalloc::Heap::capacity): Deleted.
* bmalloc/Heap.h:
* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::VMHeap):
(bmalloc::VMHeap::allocateSmallChunk):
(bmalloc::VMHeap::allocateMediumChunk):
(bmalloc::VMHeap::allocateLargeChunk):
* bmalloc/VMHeap.h:
(bmalloc::VMHeap::allocateSmallPage):
(bmalloc::VMHeap::allocateMediumPage):
(bmalloc::VMHeap::allocateLargeRange):
(bmalloc::VMHeap::deallocateSmallPage):
(bmalloc::VMHeap::deallocateMediumPage):
(bmalloc::VMHeap::deallocateLargeRange):
(bmalloc::VMHeap::size): Deleted.
(bmalloc::VMHeap::capacity): Deleted.
* bmalloc/bmalloc.h:
(bmalloc::api::heapSize): Deleted.
(bmalloc::api::heapCapacity): Deleted.
Modified Paths
Diff
Modified: trunk/Source/bmalloc/ChangeLog (173907 => 173908)
--- trunk/Source/bmalloc/ChangeLog 2014-09-24 03:31:50 UTC (rev 173907)
+++ trunk/Source/bmalloc/ChangeLog 2014-09-24 05:07:19 UTC (rev 173908)
@@ -1,5 +1,39 @@
2014-09-23 Geoffrey Garen <gga...@apple.com>
+ Rolled out r173346.
+
+ bmalloc should honor the FastMalloc statistics API
+ https://bugs.webkit.org/show_bug.cgi?id=136592
+
+ This didn't really work. Because we allow ranges with and without
+ physical pages to merge, and we allow double-committing and
+ double-decommitting, we can't rely on commit actions to track memory
+ footprint.
+
+ * bmalloc/Heap.cpp:
+ (bmalloc::Heap::size): Deleted.
+ (bmalloc::Heap::capacity): Deleted.
+ * bmalloc/Heap.h:
+ * bmalloc/VMHeap.cpp:
+ (bmalloc::VMHeap::VMHeap):
+ (bmalloc::VMHeap::allocateSmallChunk):
+ (bmalloc::VMHeap::allocateMediumChunk):
+ (bmalloc::VMHeap::allocateLargeChunk):
+ * bmalloc/VMHeap.h:
+ (bmalloc::VMHeap::allocateSmallPage):
+ (bmalloc::VMHeap::allocateMediumPage):
+ (bmalloc::VMHeap::allocateLargeRange):
+ (bmalloc::VMHeap::deallocateSmallPage):
+ (bmalloc::VMHeap::deallocateMediumPage):
+ (bmalloc::VMHeap::deallocateLargeRange):
+ (bmalloc::VMHeap::size): Deleted.
+ (bmalloc::VMHeap::capacity): Deleted.
+ * bmalloc/bmalloc.h:
+ (bmalloc::api::heapSize): Deleted.
+ (bmalloc::api::heapCapacity): Deleted.
+
+2014-09-23 Geoffrey Garen <gga...@apple.com>
+
bmalloc: Allocation should be more precise
https://bugs.webkit.org/show_bug.cgi?id=136993
Modified: trunk/Source/bmalloc/bmalloc/Heap.cpp (173907 => 173908)
--- trunk/Source/bmalloc/bmalloc/Heap.cpp 2014-09-24 03:31:50 UTC (rev 173907)
+++ trunk/Source/bmalloc/bmalloc/Heap.cpp 2014-09-24 05:07:19 UTC (rev 173908)
@@ -369,14 +369,4 @@
m_scavenger.run();
}
-size_t Heap::size(std::lock_guard<StaticMutex>&)
-{
- return m_vmHeap.capacity() - m_vmHeap.size();
-}
-
-size_t Heap::capacity(std::lock_guard<StaticMutex>&)
-{
- return m_vmHeap.capacity();
-}
-
} // namespace bmalloc
Modified: trunk/Source/bmalloc/bmalloc/Heap.h (173907 => 173908)
--- trunk/Source/bmalloc/bmalloc/Heap.h 2014-09-24 03:31:50 UTC (rev 173907)
+++ trunk/Source/bmalloc/bmalloc/Heap.h 2014-09-24 05:07:19 UTC (rev 173908)
@@ -64,9 +64,6 @@
void scavenge(std::unique_lock<StaticMutex>&, std::chrono::milliseconds sleepDuration);
- size_t size(std::lock_guard<StaticMutex>&);
- size_t capacity(std::lock_guard<StaticMutex>&);
-
private:
~Heap() = delete;
Modified: trunk/Source/bmalloc/bmalloc/VMHeap.cpp (173907 => 173908)
--- trunk/Source/bmalloc/bmalloc/VMHeap.cpp 2014-09-24 03:31:50 UTC (rev 173907)
+++ trunk/Source/bmalloc/bmalloc/VMHeap.cpp 2014-09-24 05:07:19 UTC (rev 173908)
@@ -33,8 +33,6 @@
namespace bmalloc {
VMHeap::VMHeap()
- : m_size(0)
- , m_capacity(0)
{
}
@@ -43,9 +41,6 @@
SmallChunk* chunk = SmallChunk::create();
for (auto* it = chunk->begin(); it != chunk->end(); ++it)
m_smallPages.push(it);
-
- m_size += smallChunkSize;
- m_capacity += smallChunkSize;
}
void VMHeap::allocateMediumChunk()
@@ -53,20 +48,12 @@
MediumChunk* chunk = MediumChunk::create();
for (auto* it = chunk->begin(); it != chunk->end(); ++it)
m_mediumPages.push(it);
-
- m_size += mediumChunkSize;
- m_capacity += mediumChunkSize;
}
Range VMHeap::allocateLargeChunk()
{
LargeChunk* chunk = LargeChunk::create();
- Range result = BoundaryTag::init(chunk);
-
- m_size += largeChunkSize;
- m_capacity += largeChunkSize;
-
- return result;
+ return BoundaryTag::init(chunk);
}
} // namespace bmalloc
Modified: trunk/Source/bmalloc/bmalloc/VMHeap.h (173907 => 173908)
--- trunk/Source/bmalloc/bmalloc/VMHeap.h 2014-09-24 03:31:50 UTC (rev 173907)
+++ trunk/Source/bmalloc/bmalloc/VMHeap.h 2014-09-24 05:07:19 UTC (rev 173908)
@@ -45,9 +45,6 @@
public:
VMHeap();
- size_t size() { return m_size; }
- size_t capacity() { return m_capacity; }
-
SmallPage* allocateSmallPage();
MediumPage* allocateMediumPage();
Range allocateLargeRange(size_t);
@@ -61,9 +58,6 @@
void allocateMediumChunk();
Range allocateLargeChunk();
- size_t m_size;
- size_t m_capacity;
-
Vector<SmallPage*> m_smallPages;
Vector<MediumPage*> m_mediumPages;
SegregatedFreeList m_largeRanges;
@@ -74,7 +68,6 @@
if (!m_smallPages.size())
allocateSmallChunk();
- m_size -= vmPageSize;
return m_smallPages.pop();
}
@@ -83,7 +76,6 @@
if (!m_mediumPages.size())
allocateMediumChunk();
- m_size -= vmPageSize;
return m_mediumPages.pop();
}
@@ -92,7 +84,6 @@
Range range = m_largeRanges.take(size);
if (!range)
range = allocateLargeChunk();
- m_size -= range.size();
return range;
}
@@ -102,7 +93,6 @@
vmDeallocatePhysicalPages(page->begin()->begin(), vmPageSize);
lock.lock();
- m_size += vmPageSize;
m_smallPages.push(page);
}
@@ -112,7 +102,6 @@
vmDeallocatePhysicalPages(page->begin()->begin(), vmPageSize);
lock.lock();
- m_size += vmPageSize;
m_mediumPages.push(page);
}
@@ -136,7 +125,6 @@
beginTag->setHasPhysicalPages(false);
endTag->setHasPhysicalPages(false);
- m_size += range.size();
m_largeRanges.insert(range);
}
Modified: trunk/Source/bmalloc/bmalloc/bmalloc.h (173907 => 173908)
--- trunk/Source/bmalloc/bmalloc/bmalloc.h 2014-09-24 03:31:50 UTC (rev 173907)
+++ trunk/Source/bmalloc/bmalloc/bmalloc.h 2014-09-24 05:07:19 UTC (rev 173908)
@@ -87,17 +87,5 @@
PerProcess<Heap>::get()->scavenge(lock, std::chrono::milliseconds(0));
}
-inline size_t heapSize()
-{
- std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
- return PerProcess<Heap>::get()->size(lock);
-}
-
-inline size_t heapCapacity()
-{
- std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
- return PerProcess<Heap>::get()->capacity(lock);
-}
-
} // namespace api
} // namespace bmalloc