mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Inline the storage for thread name in prof_tdata_t.
The previous approach managed the thread name in a separate buffer, which causes races because the thread name update (triggered by new samples) can happen at the same time as prof dumping (which reads the thread names) -- these two operations are under separate locks to avoid blocking each other. Implemented the thread name storage as part of the tdata struct, which resolves the lifetime issue and also avoids internal alloc / dalloc during prof_sample.
This commit is contained in:
@@ -243,8 +243,7 @@ prof_try_log(tsd_t *tsd, size_t usize, prof_info_t *prof_info) {
|
||||
iallocztm(tsd_tsdn(tsd), sz, sz_size2index(sz), false, NULL, true,
|
||||
arena_get(TSDN_NULL, 0, true), true);
|
||||
|
||||
const char *prod_thr_name = (tctx->tdata->thread_name == NULL)?
|
||||
"" : tctx->tdata->thread_name;
|
||||
const char *prod_thr_name = tctx->tdata->thread_name;
|
||||
const char *cons_thr_name = prof_thread_name_get(tsd);
|
||||
|
||||
prof_bt_t bt;
|
||||
|
||||
Reference in New Issue
Block a user