mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 13:13:06 +00:00
Fallback to unbuffered printing if OOM
This commit is contained in:
@@ -3716,12 +3716,16 @@ je_malloc_stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
char *buf = (char *)iallocztm(tsdn, STATS_PRINT_BUFSIZE,
|
||||
sz_size2index(STATS_PRINT_BUFSIZE), false, NULL, true,
|
||||
arena_get(TSDN_NULL, 0, true), true);
|
||||
buf_write_arg_t buf_arg;
|
||||
buf_write_init(&buf_arg, write_cb, cbopaque, buf,
|
||||
STATS_PRINT_BUFSIZE);
|
||||
stats_print(buf_write_cb, &buf_arg, opts);
|
||||
buf_write_flush(&buf_arg);
|
||||
idalloctm(tsdn, buf, NULL, NULL, true, true);
|
||||
if (buf == NULL) {
|
||||
stats_print(write_cb, cbopaque, opts);
|
||||
} else {
|
||||
buf_write_arg_t buf_arg;
|
||||
buf_write_init(&buf_arg, write_cb, cbopaque, buf,
|
||||
STATS_PRINT_BUFSIZE);
|
||||
stats_print(buf_write_cb, &buf_arg, opts);
|
||||
buf_write_flush(&buf_arg);
|
||||
idalloctm(tsdn, buf, NULL, NULL, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
check_entry_exit_locking(tsdn);
|
||||
|
||||
Reference in New Issue
Block a user