diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2020-02-10 23:08:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-10 23:08:33 -0500 |
| commit | e624c862894ec50998aafb3026d4ed45208acd6d (patch) | |
| tree | a01d54c8d5ba3178eaed1fa8d0ef9c081d95d9f2 /src/mem.cpp | |
| parent | 26183660558c43133d862912c602e316f43698c7 (diff) | |
| parent | edb210905dcbe666fa5222bceacd2e5bdb16bb89 (diff) | |
| download | zig-e624c862894ec50998aafb3026d4ed45208acd6d.tar.gz zig-e624c862894ec50998aafb3026d4ed45208acd6d.zip | |
Merge pull request #4389 from mikdusan/stage1-mem
stage1: memory/report overhaul
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 |
