summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-18 22:44:46 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-18 22:44:46 +0000
commit28af26d878126d92d8f124cba5143dbd7e4233cd (patch)
treece0800ec8b83b1be178442949a843d9790d8c1a2 /llvm/lib/Support
parent75f5cd671bcd979af8cf7ab6e98f0ea090d698f1 (diff)
downloadbcm5719-llvm-28af26d878126d92d8f124cba5143dbd7e4233cd.tar.gz
bcm5719-llvm-28af26d878126d92d8f124cba5143dbd7e4233cd.zip
Add BumpPtrAllocator::getTotalMemory() to allow clients to query how much memory a BumpPtrAllocator allocated.
llvm-svn: 129727
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Allocator.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/Allocator.cpp b/llvm/lib/Support/Allocator.cpp
index 5e27df6628e..215b0f249d9 100644
--- a/llvm/lib/Support/Allocator.cpp
+++ b/llvm/lib/Support/Allocator.cpp
@@ -136,6 +136,14 @@ unsigned BumpPtrAllocator::GetNumSlabs() const {
return NumSlabs;
}
+size_t BumpPtrAllocator::getTotalMemory() const {
+ size_t TotalMemory = 0;
+ for (MemSlab *Slab = CurSlab; Slab != 0; Slab = Slab->NextPtr) {
+ TotalMemory += Slab->Size;
+ }
+ return TotalMemory;
+}
+
void BumpPtrAllocator::PrintStats() const {
unsigned NumSlabs = 0;
size_t TotalMemory = 0;
OpenPOWER on IntegriCloud