mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-26 09:03:33 +03:00
Restructure profiling
Develop new data structure and code logic for holding profiling related information stored in the extent that may be needed after the extent is released, which in particular is the case for the reallocation code path (e.g. in `rallocx()` and `xallocx()`). The data structure is a generalization of `prof_tctx_t`: we previously only copy out the `prof_tctx` before the extent is released, but we may be in need of additional fields. Currently the only additional field is the allocation time field, but there may be more fields in the future. The restructuring also resolved a bug: `prof_realloc()` mistakenly passed the new `ptr` to `prof_free_sampled_object()`, but passing in the `old_ptr` would crash because it's already been released. Now the essential profiling information is collectively copied out early and safely passed to `prof_free_sampled_object()` after the extent is released.
This commit is contained in:
parent
8b2c2a596d
commit
b55419f9b9
12 changed files with 82 additions and 92 deletions
|
|
@ -333,15 +333,12 @@ extent_slab_data_get_const(const extent_t *extent) {
|
|||
return &extent->e_slab_data;
|
||||
}
|
||||
|
||||
static inline prof_tctx_t *
|
||||
extent_prof_tctx_get(const extent_t *extent) {
|
||||
return (prof_tctx_t *)atomic_load_p(&extent->e_prof_tctx,
|
||||
ATOMIC_ACQUIRE);
|
||||
}
|
||||
|
||||
static inline nstime_t
|
||||
extent_prof_alloc_time_get(const extent_t *extent) {
|
||||
return extent->e_alloc_time;
|
||||
static inline void
|
||||
extent_prof_info_get(const extent_t *extent, prof_info_t *prof_info) {
|
||||
assert(prof_info != NULL);
|
||||
prof_info->prof_tctx = (prof_tctx_t *)atomic_load_p(
|
||||
&extent->e_prof_tctx, ATOMIC_ACQUIRE);
|
||||
prof_info->alloc_time = extent->e_alloc_time;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue