mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Allow setting a dump hook
If users want to be notified when a heap dump occurs, they can set this hook.
This commit is contained in:
committed by
Alexander Lapenkov
parent
f7d46b8119
commit
a9031a0970
16
src/prof.c
16
src/prof.c
@@ -73,6 +73,9 @@ bool prof_booted = false;
|
||||
/* Logically a prof_backtrace_hook_t. */
|
||||
atomic_p_t prof_backtrace_hook;
|
||||
|
||||
/* Logically a prof_dump_hook_t. */
|
||||
atomic_p_t prof_dump_hook;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void
|
||||
@@ -533,6 +536,17 @@ prof_backtrace_hook_get() {
|
||||
ATOMIC_ACQUIRE);
|
||||
}
|
||||
|
||||
void
|
||||
prof_dump_hook_set(prof_dump_hook_t hook) {
|
||||
atomic_store_p(&prof_dump_hook, hook, ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
prof_dump_hook_t
|
||||
prof_dump_hook_get() {
|
||||
return (prof_dump_hook_t)atomic_load_p(&prof_dump_hook,
|
||||
ATOMIC_ACQUIRE);
|
||||
}
|
||||
|
||||
void
|
||||
prof_boot0(void) {
|
||||
cassert(config_prof);
|
||||
@@ -672,8 +686,8 @@ prof_boot2(tsd_t *tsd, base_t *base) {
|
||||
}
|
||||
}
|
||||
|
||||
prof_hooks_init();
|
||||
prof_unwind_init();
|
||||
prof_hooks_init();
|
||||
}
|
||||
prof_booted = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user