mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-01 07:58:05 +03:00
Add prof_leak_error option
The option makes the process to exit with error code 1 if a memory leak is detected. This is useful for implementing automated tools that rely on leak detection.
This commit is contained in:
parent
eafd2ac39f
commit
b798fabdf7
8 changed files with 56 additions and 0 deletions
|
|
@ -1037,6 +1037,16 @@ prof_leakcheck(const prof_cnt_t *cnt_all, size_t leak_ngctx) {
|
|||
1) ? "s" : "", leak_ngctx, (leak_ngctx != 1) ? "s" : "");
|
||||
malloc_printf(
|
||||
"<jemalloc>: Run jeprof on dump output for leak detail\n");
|
||||
if (opt_prof_leak_error) {
|
||||
malloc_printf(
|
||||
"<jemalloc>: Exiting with error code because memory"
|
||||
" leaks were detected\n");
|
||||
/*
|
||||
* Use _exit() with underscore to avoid calling atexit()
|
||||
* and entering endless cycle.
|
||||
*/
|
||||
_exit(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue