diff --git a/.github/workflows/reusable_proxy_lib.yml b/.github/workflows/reusable_proxy_lib.yml index e73dabe29f..27a66267d1 100644 --- a/.github/workflows/reusable_proxy_lib.yml +++ b/.github/workflows/reusable_proxy_lib.yml @@ -49,7 +49,7 @@ jobs: -DUMF_BUILD_BENCHMARKS=OFF -DUMF_BUILD_TESTS=ON -DUMF_FORMAT_CODE_STYLE=OFF - -DUMF_DEVELOPER_MODE=OFF + -DUMF_DEVELOPER_MODE=ON -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON -DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON -DUMF_TESTS_FAIL_ON_SKIP=ON diff --git a/CMakeLists.txt b/CMakeLists.txt index 0eea5faf42..0b88f95b5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,11 @@ else() message(FATAL_ERROR "Unknown OS type") endif() +if(UMF_DEVELOPER_MODE) + set(UMF_COMMON_COMPILE_DEFINITIONS ${UMF_COMMON_COMPILE_DEFINITIONS} + UMF_DEVELOPER_MODE=1) +endif() + if(NOT UMF_BUILD_LIBUMF_POOL_JEMALLOC) set(UMF_POOL_JEMALLOC_ENABLED FALSE) set(JEMALLOC_FOUND FALSE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2a27dce464..2d83faacf0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,8 @@ set(UMF_CUDA_INCLUDE_DIR # Compile definitions for UMF library. # # TODO: Cleanup the compile definitions across all the CMake files -set(UMF_COMMON_COMPILE_DEFINITIONS UMF_VERSION=${UMF_VERSION}) +set(UMF_COMMON_COMPILE_DEFINITIONS ${UMF_COMMON_COMPILE_DEFINITIONS} + UMF_VERSION=${UMF_VERSION}) set(BA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/base_alloc/base_alloc.c diff --git a/src/base_alloc/base_alloc.c b/src/base_alloc/base_alloc.c index 209ace7fe3..6f975307dc 100644 --- a/src/base_alloc/base_alloc.c +++ b/src/base_alloc/base_alloc.c @@ -303,7 +303,13 @@ void umf_ba_destroy(umf_ba_pool_t *pool) { #ifndef NDEBUG ba_debug_checks(pool); if (pool->metadata.n_allocs) { - LOG_ERR("pool->metadata.n_allocs = %zu", pool->metadata.n_allocs); + LOG_ERR("number of base allocator memory leaks: %zu", + pool->metadata.n_allocs); + +#ifdef UMF_DEVELOPER_MODE + assert(pool->metadata.n_allocs == 0 && + "memory leaks in base allocator occurred"); +#endif } #endif /* NDEBUG */ diff --git a/test/provider_devdax_memory.cpp b/test/provider_devdax_memory.cpp index 1feaaaaa63..7765dd08da 100644 --- a/test/provider_devdax_memory.cpp +++ b/test/provider_devdax_memory.cpp @@ -165,6 +165,7 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) { ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); umfMemoryProviderDestroy(hProvider); + umfDevDaxMemoryProviderParamsDestroy(params); // fail test if the "sf" flag was not found ASSERT_EQ(flag_found, true); diff --git a/test/provider_file_memory.cpp b/test/provider_file_memory.cpp index 0d54c287cb..cfa37be31a 100644 --- a/test/provider_file_memory.cpp +++ b/test/provider_file_memory.cpp @@ -162,6 +162,7 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) { ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); umfMemoryProviderDestroy(hProvider); + umfFileMemoryProviderParamsDestroy(params); // fail test if the "sf" flag was not found ASSERT_EQ(flag_found, true); diff --git a/test/provider_os_memory_multiple_numa_nodes.cpp b/test/provider_os_memory_multiple_numa_nodes.cpp index e493a427ca..cfc58f2f06 100644 --- a/test/provider_os_memory_multiple_numa_nodes.cpp +++ b/test/provider_os_memory_multiple_numa_nodes.cpp @@ -674,17 +674,17 @@ TEST_P(testNumaSplit, checkModeSplit) { auto [required_numa_nodes, pages, in, out] = param; umf_result_t umf_result; - umf_os_memory_provider_params_handle_t os_memory_provider_params = nullptr; - - umf_result = umfOsMemoryProviderParamsCreate(&os_memory_provider_params); - ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); - std::vector numa_nodes = get_available_numa_nodes(); if (numa_nodes.size() < required_numa_nodes) { GTEST_SKIP_("Not enough numa nodes"); } + umf_os_memory_provider_params_handle_t os_memory_provider_params = nullptr; + + umf_result = umfOsMemoryProviderParamsCreate(&os_memory_provider_params); + ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); + ASSERT_EQ(out.size(), pages) << "Wrong test input - out array size doesn't match page count";