mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-15 17:36:21 +03:00
Safety checks: Add a redzoning feature.
This commit is contained in:
parent
b92c9a1a81
commit
33e1dad680
12 changed files with 233 additions and 22 deletions
16
src/prof.c
16
src/prof.c
|
|
@ -125,7 +125,7 @@ struct prof_thr_node_s {
|
|||
uint64_t thr_uid;
|
||||
/* Variable size based on thr_name_sz. */
|
||||
char name[1];
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct prof_alloc_node_s prof_alloc_node_t;
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ prof_log_bt_index(tsd_t *tsd, prof_bt_t *bt) {
|
|||
|
||||
new_node->next = NULL;
|
||||
new_node->index = log_bt_index;
|
||||
/*
|
||||
/*
|
||||
* Copy the backtrace: bt is inside a tdata or gctx, which
|
||||
* might die before prof_log_stop is called.
|
||||
*/
|
||||
|
|
@ -402,7 +402,7 @@ prof_log_bt_index(tsd_t *tsd, prof_bt_t *bt) {
|
|||
} else {
|
||||
return node->index;
|
||||
}
|
||||
}
|
||||
}
|
||||
static size_t
|
||||
prof_log_thr_index(tsd_t *tsd, uint64_t thr_uid, const char *name) {
|
||||
assert(prof_logging_state == prof_logging_state_started);
|
||||
|
|
@ -452,7 +452,7 @@ prof_try_log(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx) {
|
|||
* it's being destroyed).
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
malloc_mutex_lock(tsd_tsdn(tsd), &log_mtx);
|
||||
|
||||
|
|
@ -514,11 +514,11 @@ prof_try_log(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx) {
|
|||
}
|
||||
|
||||
label_done:
|
||||
malloc_mutex_unlock(tsd_tsdn(tsd), &log_mtx);
|
||||
malloc_mutex_unlock(tsd_tsdn(tsd), &log_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
prof_free_sampled_object(tsd_t *tsd, const void *ptr, size_t usize,
|
||||
prof_free_sampled_object(tsd_t *tsd, const void *ptr, size_t usize,
|
||||
prof_tctx_t *tctx) {
|
||||
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
|
||||
|
||||
|
|
@ -2604,8 +2604,8 @@ static void
|
|||
prof_log_emit_traces(tsd_t *tsd, emitter_t *emitter) {
|
||||
emitter_json_array_kv_begin(emitter, "stack_traces");
|
||||
prof_bt_node_t *bt_node = log_bt_first;
|
||||
prof_bt_node_t *bt_old_node;
|
||||
/*
|
||||
prof_bt_node_t *bt_old_node;
|
||||
/*
|
||||
* Calculate how many hex digits we need: twice number of bytes, two for
|
||||
* "0x", and then one more for terminating '\0'.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue