1 //===--- Allocator.cpp - Simple memory allocation abstraction -------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements the BumpPtrAllocator interface.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/Support/Allocator.h"
14 #include "llvm/Support/raw_ostream.h"
20 void printBumpPtrAllocatorStats(unsigned NumSlabs
, size_t BytesAllocated
,
22 errs() << "\nNumber of memory regions: " << NumSlabs
<< '\n'
23 << "Bytes used: " << BytesAllocated
<< '\n'
24 << "Bytes allocated: " << TotalMemory
<< '\n'
25 << "Bytes wasted: " << (TotalMemory
- BytesAllocated
)
26 << " (includes alignment, etc)\n";
29 } // End namespace detail.
31 void PrintRecyclerStats(size_t Size
,
33 size_t FreeListSize
) {
34 errs() << "Recycler element size: " << Size
<< '\n'
35 << "Recycler element alignment: " << Align
<< '\n'
36 << "Number of elements free for recycling: " << FreeListSize
<< '\n';