Skip to content

Commit 7d09346

Browse files
authored
fix(ci): malloc trim on sanitizers workflow (#2794)
* remove malloc_trim from sanitizers build
1 parent 9e23f85 commit 7d09346

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/server/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ if (PRINT_STACKTRACES_ON_SIGNAL)
6161
target_compile_definitions(dragonfly_lib PRIVATE PRINT_STACKTRACES_ON_SIGNAL)
6262
endif()
6363

64+
if (WITH_ASAN OR WITH_USAN)
65+
target_compile_definitions(dfly_transaction PRIVATE SANITIZERS)
66+
endif()
67+
6468
find_library(ZSTD_LIB NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR REQUIRED)
6569

6670
cxx_link(dfly_transaction dfly_core strings_lib TRDP::fast_float)

src/server/server_state.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ void ServerState::DecommitMemory(uint8_t flags) {
166166
// trims the memory (reduces RSS usage) from the malloc allocator. Does not present in
167167
// MUSL lib.
168168
#ifdef __GLIBC__
169+
// There is an issue with malloc_trim and sanitizers because the asan replace malloc but is not
170+
// aware of malloc_trim which causes malloc_trim to segfault because it's not initialized properly
171+
#ifndef SANITIZERS
169172
malloc_trim(0);
173+
#endif
170174
#endif
171175
}
172176
}

0 commit comments

Comments
 (0)