[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36640] trunk/blender: option to link with jemalloc on *nix, off by default.

Campbell Barton ideasman42 at gmail.com
Thu May 12 13:16:33 CEST 2011


Revision: 36640
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36640
Author:   campbellbarton
Date:     2011-05-12 11:16:32 +0000 (Thu, 12 May 2011)
Log Message:
-----------
option to link with jemalloc on *nix, off by default.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/cmake/macros.cmake

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2011-05-12 09:17:03 UTC (rev 36639)
+++ trunk/blender/CMakeLists.txt	2011-05-12 11:16:32 UTC (rev 36640)
@@ -175,6 +175,10 @@
 endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 
+# disable for now, but plan to support on all platforms eventually
+option(WITH_MEM_JEMALLOC   "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
+mark_as_advanced(WITH_MEM_JEMALLOC)
+
 # Debug
 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
 mark_as_advanced(WITH_CXX_GUARDEDALLOC)
@@ -424,6 +428,15 @@
 		set(EXPAT_LIB expat)
 	endif()
 
+	if(WITH_MEM_JEMALLOC)
+		set(JEMALLOC /usr)
+		set(JEMALLOC_LIBRARY ljemalloc CACHE STRING "JeMalloc library")
+		set(JEMALLOC_LIBPATH ${JEMALLOC}/lib  CACHE FILEPATH "JeMalloc library path")
+		# no use for this yet.
+		# set(JEMALLOC_INCLUDE_DIR ${JEMALLOC}/include  CACHE FILEPATH "JeMalloc include path")
+		unset(JEMALLOC)
+	endif()
+
 	find_package(X11 REQUIRED)
 	find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
 	mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)

Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake	2011-05-12 09:17:03 UTC (rev 36639)
+++ trunk/blender/build_files/cmake/macros.cmake	2011-05-12 11:16:32 UTC (rev 36640)
@@ -114,6 +114,9 @@
 		link_directories(${PCRE_LIBPATH})
 		link_directories(${EXPAT_LIBPATH})
 	endif()
+	if(WITH_MEM_JEMALLOC)
+		link_directories(${JEMALLOC_LIBPATH})
+	endif()
 
 	if(WIN32 AND NOT UNIX)
 		link_directories(${PTHREADS_LIBPATH})
@@ -220,6 +223,9 @@
 			target_link_libraries(${target} optimized ${LCMS_LIB})
 		endif()
 	endif()
+	if(WITH_MEM_JEMALLOC)
+		target_link_libraries(${target} ${JEMALLOC_LIBRARY})
+	endif()
 	if(WIN32 AND NOT UNIX)
 		target_link_libraries(${target} ${PTHREADS_LIB})
 	endif()




More information about the Bf-blender-cvs mailing list