10 typedef int (*
mallctl_t)(
const char *
name,
void *oldp,
size_t *oldlenp,
void *newp,
size_t newlen);
14 bool initialize_prof();
16 const bool have_jemalloc_and_prof = initialize_prof();
18 bool initialize_prof() {
20 mallctl = (
mallctl_t)::dlsym(RTLD_DEFAULT,
"mallctl");
21 if (mallctl ==
nullptr)
24 bool enable_prof =
false;
25 size_t bool_s =
sizeof(
bool);
26 mallctl(
"prof.active", &enable_prof, &bool_s,
nullptr, 0);
35 if (!have_jemalloc_and_prof) {
39 <<
"JeProfModule requested but application is not" 40 <<
" currently being profiled with jemalloc profiling enabled\n" 41 <<
"Enable jemalloc profiling by running\n" 42 <<
"MALLOC_CONF=prof_leak:true,lg_prof_sample:10,prof_final:true cmsRunJEProf config.py\n";
46 mallctl(
"prof.dump",
nullptr,
nullptr, &
fileName,
sizeof(
const char *));
void makeHeapDump(const char *)
std::once_flag warning_flag
int(* mallctl_t)(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
Log< level::Warning, false > LogWarning