diff options
Diffstat (limited to 'src/mem.cpp')
| -rw-r--r-- | src/mem.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mem.cpp b/src/mem.cpp new file mode 100644 index 0000000000..51ee9a27ee --- /dev/null +++ b/src/mem.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020 Andrew Kelley + * + * This file is part of zig, which is MIT licensed. + * See http://opensource.org/licenses/MIT + */ + +#include "config.h" +#include "mem.hpp" +#include "mem_profile.hpp" +#include "heap.hpp" + +namespace mem { + +void init() { + heap::bootstrap_allocator_state.init("heap::bootstrap_allocator"); + heap::c_allocator_state.init("heap::c_allocator"); +} + +void deinit() { + heap::c_allocator_state.deinit(); + heap::bootstrap_allocator_state.deinit(); +} + +#ifdef ZIG_ENABLE_MEM_PROFILE +void print_report(FILE *file) { + heap::c_allocator_state.print_report(file); + intern_counters.print_report(file); +} +#endif + +#ifdef ZIG_ENABLE_MEM_PROFILE +bool report_print = false; +FILE *report_file{nullptr}; +#endif + +} // namespace mem |
