From 68df7fa6057a29b3130d41a27592f74d58c2df57 Mon Sep 17 00:00:00 2001 From: "chappedm@gmail.com" Date: Sat, 3 Mar 2012 19:45:49 +0000 Subject: [PATCH] issue-405: Added a tunable to the heap checker that allows the heap checker error exit code to be overridden. For larger projects this allows certain heap checked programs that have intentional/known leaks to be managed. git-svn-id: http://gperftools.googlecode.com/svn/trunk@147 6b5cf1ce-ec42-a296-1ba9-69fdba395a50 --- src/heap-checker.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/heap-checker.cc b/src/heap-checker.cc index cb71ae1..5967b02 100644 --- a/src/heap-checker.cc +++ b/src/heap-checker.cc @@ -223,6 +223,10 @@ DEFINE_int32(heap_check_delay_seconds, 0, " its checks. Report any such issues to the heap-checker" " maintainer(s)."); +DEFINE_int32(heap_check_error_exit_code, + EnvToInt("HEAP_CHECK_ERROR_EXIT_CODE", 1), + "Exit code to return if any leaks were detected."); + //---------------------------------------------------------------------- DEFINE_string(heap_profile_pprof, @@ -2157,7 +2161,8 @@ bool HeapLeakChecker::DoMainHeapCheck() { } RAW_LOG(ERROR, "Exiting with error code (instead of crashing) " "because of whole-program memory leaks"); - _exit(1); // we don't want to call atexit() routines! + // We don't want to call atexit() routines! + _exit(FLAGS_heap_check_error_exit_code); } return true; }