mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-25 18:17:19 +03: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:
parent
6cab460a45
commit
ce0b7ab6c8
11 changed files with 120 additions and 103 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue