diff options
| author | gingerBill <bill@gingerbill.org> | 2023-03-16 15:04:57 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-03-16 15:04:57 +0000 |
| commit | c1c7128634db88915860ed56f7a1e45317f7c02d (patch) | |
| tree | 89149d5487fe51ee63abeef16e3b3f5d4a92c375 /src/main.cpp | |
| parent | e05944601a07e6cb9c0ec84f80ca4ca3511c84ea (diff) | |
Minimize severe memory usage by enforcing the `heap_allocator()` in places
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index 9a2a1ebf8..82c20cfe6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,6 +27,21 @@ gb_internal void thread_pool_wait(void) { } +gb_internal i64 PRINT_PEAK_USAGE(void) { + if (build_context.show_more_timings) { + #if defined(GB_SYSTEM_WINDOWS) + PROCESS_MEMORY_COUNTERS p = {sizeof(p)}; + if (GetProcessMemoryInfo(GetCurrentProcess(), &p, sizeof(p))) { + gb_printf("\n"); + gb_printf("Peak Memory Size: %.3f MiB\n", (cast(f64)p.PeakWorkingSetSize) / cast(f64)(1024ull * 1024ull)); + return cast(i64)p.PeakWorkingSetSize; + } + #endif + } + return 0; +} + + gb_global BlockingMutex debugf_mutex; gb_internal void debugf(char const *fmt, ...) { @@ -1731,15 +1746,7 @@ gb_internal void show_timings(Checker *c, Timings *t) { timings_print_all(t); - if (build_context.show_more_timings) { - #if defined(GB_SYSTEM_WINDOWS) - PROCESS_MEMORY_COUNTERS p = {sizeof(p)}; - if (GetProcessMemoryInfo(GetCurrentProcess(), &p, sizeof(p))) { - gb_printf("\n"); - gb_printf("Peak Memory Size: %.3f MiB\n", (cast(f64)p.PeakWorkingSetSize) / cast(f64)(1024ull * 1024ull)); - } - #endif - } + PRINT_PEAK_USAGE(); if (!(build_context.export_timings_format == TimingsExportUnspecified)) { timings_export_all(t, c, true); |