diff --git a/CMakeLists.txt b/CMakeLists.txt index 81fe49b1..d78a6ca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,13 @@ include(GNUInstallDirs) find_package(ICU REQUIRED uc) find_package(Threads REQUIRED) +# Switch to jemalloc (http://jemalloc.net) as the malloc/free +# implementation in renderd. +# Should address https://github.com/openstreetmap/mod_tile/issues/181 +find_package(PkgConfig REQUIRED) +pkg_check_modules(JEMALLOC jemalloc) +pkg_search_module(JEMALLOC REQUIRED jemalloc) + find_package(APR REQUIRED) find_package(GLIB 2.50 REQUIRED) find_package(HTTPD 2.4 REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 046e49ab..220897ec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -183,7 +183,9 @@ set(renderd_SRCS renderd.c request_queue.c ) +# JEMALLOC libraries should come *before* the GLIB libraries. set(renderd_LIBS + ${JEMALLOC_LIBRARIES} ${ICU_LIBRARIES} ${LIBMAPNIK_LIBRARIES} ${RENDER_LIBRARIES}