fix(ci): malloc trim on sanitizers workflow (#2794)

* remove malloc_trim from sanitizers build
This commit is contained in:
Kostas Kyrimis 2024-03-30 21:52:43 +02:00 committed by GitHub
parent 9e23f85e6b
commit 7d093460f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -61,6 +61,10 @@ if (PRINT_STACKTRACES_ON_SIGNAL)
target_compile_definitions(dragonfly_lib PRIVATE PRINT_STACKTRACES_ON_SIGNAL)
endif()
if (WITH_ASAN OR WITH_USAN)
target_compile_definitions(dfly_transaction PRIVATE SANITIZERS)
endif()
find_library(ZSTD_LIB NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR REQUIRED)
cxx_link(dfly_transaction dfly_core strings_lib TRDP::fast_float)

View file

@ -166,7 +166,11 @@ void ServerState::DecommitMemory(uint8_t flags) {
// trims the memory (reduces RSS usage) from the malloc allocator. Does not present in
// MUSL lib.
#ifdef __GLIBC__
// There is an issue with malloc_trim and sanitizers because the asan replace malloc but is not
// aware of malloc_trim which causes malloc_trim to segfault because it's not initialized properly
#ifndef SANITIZERS
malloc_trim(0);
#endif
#endif
}
}