Commit cd92bc38 authored by Sergei Golubchik's avatar Sergei Golubchik

start using jemalloc

parent 253366e7
......@@ -1148,3 +1148,5 @@ typescript
mysql-test/collections/default.release.done
sql/sql_yacc.hh
packaging/solaris/postinstall-solaris
extra/jemalloc/jemalloc-*
extra/jemalloc/build
......@@ -144,6 +144,7 @@ INCLUDE(ssl)
INCLUDE(readline)
INCLUDE(libutils)
INCLUDE(dtrace)
INCLUDE(jemalloc)
INCLUDE(ctest)
INCLUDE(plugin)
INCLUDE(install_macros)
......@@ -263,6 +264,8 @@ MYSQL_CHECK_SSL()
# Add readline or libedit.
MYSQL_CHECK_READLINE()
CHECK_JEMALLOC()
#
# Setup maintainer mode options by the end. Platform checks are
# not run with the warning options as to not perturb fragile checks
......
INCLUDE(ExternalProject)
MACRO (USE_BUNDLED_JEMALLOC)
SET(SOURCE_DIR "${CMAKE_SOURCE_DIR}/extra/jemalloc")
SET(BINARY_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/extra/jemalloc/build")
SET(LIBJEMALLOC "${BINARY_DIR}/lib/libjemalloc_pic.a")
SET(JEMALLOC_CONFIGURE_OPTS "CC=${CMAKE_C_COMPILER}" "--with-private-namespace=jemalloc_internal_" "--enable-cc-silence")
IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT APPLE) # see the comment in CMakeLists.txt
LIST(APPEND JEMALLOC_CONFIGURE_OPTS --enable-debug)
ENDIF()
ExternalProject_Add(jemalloc
PREFIX extra/jemalloc
SOURCE_DIR ${SOURCE_DIR}
BINARY_DIR ${BINARY_DIR}
STAMP_DIR ${SOURCE_DIR}
CONFIGURE_COMMAND "${SOURCE_DIR}/configure" ${JEMALLOC_CONFIGURE_OPTS}
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} "build_lib_static"
INSTALL_COMMAND ""
)
ADD_LIBRARY(libjemalloc STATIC IMPORTED)
SET_TARGET_PROPERTIES(libjemalloc PROPERTIES IMPORTED_LOCATION ${LIBJEMALLOC})
ADD_DEPENDENCIES(libjemalloc jemalloc)
ENDMACRO()
SET(WITH_JEMALLOC "yes" CACHE STRING
"Which jemalloc to use (possible values are 'no', 'bundled', 'yes' (same as bundled)")
#"Which jemalloc to use (possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)")
MACRO (CHECK_JEMALLOC)
IF(WITH_JEMALLOC STREQUAL "bundled" OR WITH_JEMALLOC STREQUAL "yes")
USE_BUNDLED_JEMALLOC()
ENDIF()
ENDMACRO()
......@@ -103,7 +103,7 @@ ADD_DEPENDENCIES(sql GenServerSource)
DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
mysys dbug strings vio regex
${LIBWRAP} ${LIBCRYPT} ${LIBDL}
${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${LIBJEMALLOC} ${CMAKE_THREAD_LIBS_INIT}
${SSL_LIBRARIES})
IF(WIN32)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment