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:
@@ -633,12 +633,15 @@ prof_log_stop(tsdn_t *tsdn) {
|
||||
sz_size2index(PROF_LOG_STOP_BUFSIZE), false, NULL, true,
|
||||
arena_get(TSDN_NULL, 0, true), true);
|
||||
buf_write_arg_t buf_arg;
|
||||
buf_write_init(&buf_arg, prof_emitter_write_cb, &arg, buf,
|
||||
PROF_LOG_STOP_BUFSIZE);
|
||||
|
||||
/* Emit to json. */
|
||||
emitter_init(&emitter, emitter_output_json_compact, buf_write_cb,
|
||||
&buf_arg);
|
||||
if (buf == NULL) {
|
||||
emitter_init(&emitter, emitter_output_json_compact,
|
||||
prof_emitter_write_cb, &arg);
|
||||
} else {
|
||||
buf_write_init(&buf_arg, prof_emitter_write_cb, &arg, buf,
|
||||
PROF_LOG_STOP_BUFSIZE);
|
||||
emitter_init(&emitter, emitter_output_json_compact,
|
||||
buf_write_cb, &buf_arg);
|
||||
}
|
||||
|
||||
emitter_begin(&emitter);
|
||||
prof_log_emit_metadata(&emitter);
|
||||
@@ -647,8 +650,10 @@ prof_log_stop(tsdn_t *tsdn) {
|
||||
prof_log_emit_allocs(tsd, &emitter);
|
||||
emitter_end(&emitter);
|
||||
|
||||
buf_write_flush(&buf_arg);
|
||||
idalloctm(tsdn, buf, NULL, NULL, true, true);
|
||||
if (buf != NULL) {
|
||||
buf_write_flush(&buf_arg);
|
||||
idalloctm(tsdn, buf, NULL, NULL, true, true);
|
||||
}
|
||||
|
||||
/* Reset global state. */
|
||||
if (log_tables_initialized) {
|
||||
|
||||
Reference in New Issue
Block a user