diff --git a/Makefile b/Makefile index 0669fbcf4..fbf5ecf6f 100644 --- a/Makefile +++ b/Makefile @@ -494,6 +494,7 @@ VALGRIND_ERROR = 2 VALGRIND_VER := $(join $(VALGRIND_VER),valgrind) VALGRIND_OPTS = --error-exitcode=$(VALGRIND_ERROR) --leak-check=full +# Not yet supported: --show-leak-kinds=definite,possible,reachable --errors-for-leak-kinds=definite,possible,reachable TEST_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(TEST_LIB_SOURCES) $(MOCK_LIB_SOURCES)) $(GTEST) BENCH_OBJECTS = $(patsubst %.cc, $(OBJ_DIR)/%.o, $(BENCH_LIB_SOURCES)) diff --git a/env/env_posix.cc b/env/env_posix.cc index fdcb6f6a3..583c024de 100644 --- a/env/env_posix.cc +++ b/env/env_posix.cc @@ -7,6 +7,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors +#include "port/lang.h" #if !defined(OS_WIN) #include @@ -511,6 +512,7 @@ Env* Env::Default() { ThreadLocalPtr::InitSingletons(); CompressionContextCache::InitSingleton(); INIT_SYNC_POINT_SINGLETONS(); + // ~PosixEnv must be called on exit static PosixEnv default_env; return &default_env; } diff --git a/port/lang.h b/port/lang.h index 4429f105e..eabe44b69 100644 --- a/port/lang.h +++ b/port/lang.h @@ -27,6 +27,10 @@ #endif // __SANITIZE_ADDRESS__ #endif // __clang__ +#ifdef ROCKSDB_VALGRIND_RUN +#define MUST_FREE_HEAP_ALLOCATIONS 1 +#endif // ROCKSDB_VALGRIND_RUN + // Coding guidelines say to avoid static objects with non-trivial destructors, // because it's easy to cause trouble (UB) in static destruction. This // macro makes it easier to define static objects that are normally never