summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-05-13 10:08:42 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2019-05-13 10:08:42 +0000
commit0c188d5efc452b576c46270e65b9db4746ee9dfe (patch)
tree77c645440c91916032ab73531940a7ce5c7c7377 /CMakeLists.txt
parent5c93509aad6aa952c48f078557c86322dfc35692 (diff)
downloadmariadb-git-0c188d5efc452b576c46270e65b9db4746ee9dfe.tar.gz
Make TRASH_FREED_MEMORY a cmake option, similar to SAFEMALLOC
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ea8269c14c..ed76fba7d10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -289,6 +289,16 @@ ELSEIF(WITH_SAFEMALLOC MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC")
ENDIF()
+# Another memory debugging feature
+SET(THRASH_FREED_MEMORY "AUTO" CACHE STRING "Fill freed memory with specific byte pattern. Will result in slower execution. Options are: ON OFF AUTO.")
+MARK_AS_ADVANCED(THRASH_FREED_MEMORY)
+IF(THRASH_FREED_MEMORY MATCHES "ON")
+ ADD_DEFINITIONS( -DTHRASH_FREED_MEMORY)
+ELSEIF(THRASH_FREED_MEMORY MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND AND NOT WITH_ASAN)
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DTHRASH_FREED_MEMORY")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTHRASH_FREED_MEMORY")
+ENDIF()
+
# Set commonly used variables
IF(WIN32)
SET(DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB ${MYSQL_BASE_VERSION}")