mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 21:05:56 +00:00
Log the memory commit charge with every fatal error
#94 ended on a realloc of 1 MiB that failed with 64 GB of commit allowed, and the log could not tell whether the process had grown towards the limit or the system ran short. rt_fatal now adds one line with the process's private bytes and the system's commit in use and limit (plat_commit_info). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f958a5ef71
commit
31fff74776
3 files changed
+21
No files matched your search
@@ -12,6 +12,7 @@
|
||||
// is also fixed at init; they are looked up only after the flat table misses.
|
||||
#include "dispatch.h"
|
||||
#include "host.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@@ -51,6 +52,11 @@ void rt_fatal(const char *fmt, ...) {
|
||||
rt_vlogf(fmt, ap);
|
||||
rt_log_raw("\n", 1);
|
||||
va_end(ap);
|
||||
// A failed allocation (malloc, realloc, VirtualAlloc) means the commit limit was reached: this line tells a leak of
|
||||
// ours (process private bytes near the limit) from a machine short of page file.
|
||||
double proc, used, limit;
|
||||
plat_commit_info(&proc, &used, &limit);
|
||||
rt_log("fatal: memory commit: this process %.0f MB, the system %.0f of %.0f MB", proc, used, limit);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
_Exit(70);
|
||||
|
||||
Reference in new issue
Block a user