llvm.org GIT mirror llvm / 1da29dd
Add BumpPtrAllocator::getTotalMemory() to allow clients to query how much memory a BumpPtrAllocator allocated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129727 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 9 years ago
2 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
176176 unsigned GetNumSlabs() const;
177177
178178 void PrintStats() const;
179
180 /// Compute the total physical memory allocated by this allocator.
181 size_t getTotalMemory() const;
179182 };
180183
181184 /// SpecificBumpPtrAllocator - Same as BumpPtrAllocator but allows only
135135 return NumSlabs;
136136 }
137137
138 size_t BumpPtrAllocator::getTotalMemory() const {
139 size_t TotalMemory = 0;
140 for (MemSlab *Slab = CurSlab; Slab != 0; Slab = Slab->NextPtr) {
141 TotalMemory += Slab->Size;
142 }
143 return TotalMemory;
144 }
145
138146 void BumpPtrAllocator::PrintStats() const {
139147 unsigned NumSlabs = 0;
140148 size_t TotalMemory = 0;