mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-27 22:33:15 +03:00
Guard prof_active reset by opt_prof
Set `prof_active` to read-only when `opt_prof` is turned off.
This commit is contained in:
parent
1df9dd3515
commit
beb7c16e94
4 changed files with 49 additions and 2 deletions
|
|
@ -71,8 +71,19 @@ prof_accum_cancel(tsdn_t *tsdn, prof_accum_t *prof_accum,
|
|||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
prof_active_assert() {
|
||||
cassert(config_prof);
|
||||
/*
|
||||
* If opt_prof is off, then prof_active must always be off, regardless
|
||||
* of whether prof_active_mtx is in effect or not.
|
||||
*/
|
||||
assert(opt_prof || !prof_active);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
prof_active_get_unlocked(void) {
|
||||
prof_active_assert();
|
||||
/*
|
||||
* Even if opt_prof is true, sampling can be temporarily disabled by
|
||||
* setting prof_active to false. No locking is used when reading
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue