INSTALL 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. Building and installing jemalloc can be as simple as typing the following while
  2. in the root directory of the source tree:
  3. ./configure
  4. make
  5. make install
  6. === Advanced configuration =====================================================
  7. The 'configure' script supports numerous options that allow control of which
  8. functionality is enabled, where jemalloc is installed, etc. Optionally, pass
  9. any of the following arguments (not a definitive list) to 'configure':
  10. --help
  11. Print a definitive list of options.
  12. --prefix=<install-root-dir>
  13. Set the base directory in which to install. For example:
  14. ./configure --prefix=/usr/local
  15. will cause files to be installed into /usr/local/include, /usr/local/lib,
  16. and /usr/local/man.
  17. --with-rpath=<colon-separated-rpath>
  18. Embed one or more library paths, so that libjemalloc can find the libraries
  19. it is linked to. This works only on ELF-based systems.
  20. --with-mangling=<map>
  21. Mangle public symbols specified in <map> which is a comma-separated list of
  22. name:mangled pairs.
  23. For example, to use ld's --wrap option as an alternative method for
  24. overriding libc's malloc implementation, specify something like:
  25. --with-mangling=malloc:__wrap_malloc,free:__wrap_free[...]
  26. Note that mangling happens prior to application of the prefix specified by
  27. --with-jemalloc-prefix, and mangled symbols are then ignored when applying
  28. the prefix.
  29. --with-jemalloc-prefix=<prefix>
  30. Prefix all public APIs with <prefix>. For example, if <prefix> is
  31. "prefix_", API changes like the following occur:
  32. malloc() --> prefix_malloc()
  33. malloc_conf --> prefix_malloc_conf
  34. /etc/malloc.conf --> /etc/prefix_malloc.conf
  35. MALLOC_CONF --> PREFIX_MALLOC_CONF
  36. This makes it possible to use jemalloc at the same time as the system
  37. allocator, or even to use multiple copies of jemalloc simultaneously.
  38. By default, the prefix is "", except on OS X, where it is "je_". On OS X,
  39. jemalloc overlays the default malloc zone, but makes no attempt to actually
  40. replace the "malloc", "calloc", etc. symbols.
  41. --with-private-namespace=<prefix>
  42. Prefix all library-private APIs with <prefix>. For shared libraries,
  43. symbol visibility mechanisms prevent these symbols from being exported, but
  44. for static libraries, naming collisions are a real possibility. By
  45. default, the prefix is "" (empty string).
  46. --with-install-suffix=<suffix>
  47. Append <suffix> to the base name of all installed files, such that multiple
  48. versions of jemalloc can coexist in the same installation directory. For
  49. example, libjemalloc.so.0 becomes libjemalloc<suffix>.so.0.
  50. --enable-cc-silence
  51. Enable code that silences non-useful compiler warnings. This is helpful
  52. when trying to tell serious warnings from those due to compiler
  53. limitations, but it potentially incurs a performance penalty.
  54. --enable-debug
  55. Enable assertions and validation code. This incurs a substantial
  56. performance hit, but is very useful during application development.
  57. --disable-stats
  58. Disable statistics gathering functionality. See the "opt.stats_print"
  59. option documentation for usage details.
  60. --enable-prof
  61. Enable heap profiling and leak detection functionality. See the "opt.prof"
  62. option documentation for usage details. When enabled, there are several
  63. approaches to backtracing, and the configure script chooses the first one
  64. in the following list that appears to function correctly:
  65. + libunwind (requires --enable-prof-libunwind)
  66. + libgcc (unless --disable-prof-libgcc)
  67. + gcc intrinsics (unless --disable-prof-gcc)
  68. --enable-prof-libunwind
  69. Use the libunwind library (http://www.nongnu.org/libunwind/) for stack
  70. backtracing.
  71. --disable-prof-libgcc
  72. Disable the use of libgcc's backtracing functionality.
  73. --disable-prof-gcc
  74. Disable the use of gcc intrinsics for backtracing.
  75. --with-static-libunwind=<libunwind.a>
  76. Statically link against the specified libunwind.a rather than dynamically
  77. linking with -lunwind.
  78. --disable-tcache
  79. Disable thread-specific caches for small objects. Objects are cached and
  80. released in bulk, thus reducing the total number of mutex operations. See
  81. the "opt.tcache" option for usage details.
  82. --enable-mremap
  83. Enable huge realloc() via mremap(2). mremap() is disabled by default
  84. because the flavor used is specific to Linux, which has a quirk in its
  85. virtual memory allocation algorithm that causes semi-permanent VM map holes
  86. under normal jemalloc operation.
  87. --disable-munmap
  88. Disable virtual memory deallocation via munmap(2); instead keep track of
  89. the virtual memory for later use. munmap() is disabled by default (i.e.
  90. --disable-munmap is implied) on Linux, which has a quirk in its virtual
  91. memory allocation algorithm that causes semi-permanent VM map holes under
  92. normal jemalloc operation.
  93. --enable-dss
  94. Enable support for page allocation/deallocation via sbrk(2), in addition to
  95. mmap(2).
  96. --disable-fill
  97. Disable support for junk/zero filling of memory, quarantine, and redzones.
  98. See the "opt.junk", "opt.zero", "opt.quarantine", and "opt.redzone" option
  99. documentation for usage details.
  100. --disable-valgrind
  101. Disable support for Valgrind.
  102. --disable-experimental
  103. Disable support for the experimental API (*allocm()).
  104. --enable-utrace
  105. Enable utrace(2)-based allocation tracing. This feature is not broadly
  106. portable (FreeBSD has it, but Linux and OS X do not).
  107. --enable-xmalloc
  108. Enable support for optional immediate termination due to out-of-memory
  109. errors, as is commonly implemented by "xmalloc" wrapper function for malloc.
  110. See the "opt.xmalloc" option documentation for usage details.
  111. --enable-lazy-lock
  112. Enable code that wraps pthread_create() to detect when an application
  113. switches from single-threaded to multi-threaded mode, so that it can avoid
  114. mutex locking/unlocking operations while in single-threaded mode. In
  115. practice, this feature usually has little impact on performance unless
  116. thread-specific caching is disabled.
  117. --disable-tls
  118. Disable thread-local storage (TLS), which allows for fast access to
  119. thread-local variables via the __thread keyword. If TLS is available,
  120. jemalloc uses it for several purposes.
  121. --with-xslroot=<path>
  122. Specify where to find DocBook XSL stylesheets when building the
  123. documentation.
  124. The following environment variables (not a definitive list) impact configure's
  125. behavior:
  126. CFLAGS="?"
  127. Pass these flags to the compiler. You probably shouldn't define this unless
  128. you know what you are doing. (Use EXTRA_CFLAGS instead.)
  129. EXTRA_CFLAGS="?"
  130. Append these flags to CFLAGS. This makes it possible to add flags such as
  131. -Werror, while allowing the configure script to determine what other flags
  132. are appropriate for the specified configuration.
  133. The configure script specifically checks whether an optimization flag (-O*)
  134. is specified in EXTRA_CFLAGS, and refrains from specifying an optimization
  135. level if it finds that one has already been specified.
  136. CPPFLAGS="?"
  137. Pass these flags to the C preprocessor. Note that CFLAGS is not passed to
  138. 'cpp' when 'configure' is looking for include files, so you must use
  139. CPPFLAGS instead if you need to help 'configure' find header files.
  140. LD_LIBRARY_PATH="?"
  141. 'ld' uses this colon-separated list to find libraries.
  142. LDFLAGS="?"
  143. Pass these flags when linking.
  144. PATH="?"
  145. 'configure' uses this to find programs.
  146. === Advanced compilation =======================================================
  147. To build only parts of jemalloc, use the following targets:
  148. build_lib_shared
  149. build_lib_static
  150. build_lib
  151. build_doc_html
  152. build_doc_man
  153. build_doc
  154. To install only parts of jemalloc, use the following targets:
  155. install_bin
  156. install_include
  157. install_lib_shared
  158. install_lib_static
  159. install_lib
  160. install_doc_html
  161. install_doc_man
  162. install_doc
  163. To clean up build results to varying degrees, use the following make targets:
  164. clean
  165. distclean
  166. relclean
  167. === Advanced installation ======================================================
  168. Optionally, define make variables when invoking make, including (not
  169. exclusively):
  170. INCLUDEDIR="?"
  171. Use this as the installation prefix for header files.
  172. LIBDIR="?"
  173. Use this as the installation prefix for libraries.
  174. MANDIR="?"
  175. Use this as the installation prefix for man pages.
  176. DESTDIR="?"
  177. Prepend DESTDIR to INCLUDEDIR, LIBDIR, DATADIR, and MANDIR. This is useful
  178. when installing to a different path than was specified via --prefix.
  179. CC="?"
  180. Use this to invoke the C compiler.
  181. CFLAGS="?"
  182. Pass these flags to the compiler.
  183. CPPFLAGS="?"
  184. Pass these flags to the C preprocessor.
  185. LDFLAGS="?"
  186. Pass these flags when linking.
  187. PATH="?"
  188. Use this to search for programs used during configuration and building.
  189. === Development ================================================================
  190. If you intend to make non-trivial changes to jemalloc, use the 'autogen.sh'
  191. script rather than 'configure'. This re-generates 'configure', enables
  192. configuration dependency rules, and enables re-generation of automatically
  193. generated source files.
  194. The build system supports using an object directory separate from the source
  195. tree. For example, you can create an 'obj' directory, and from within that
  196. directory, issue configuration and build commands:
  197. autoconf
  198. mkdir obj
  199. cd obj
  200. ../configure --enable-autogen
  201. make
  202. === Documentation ==============================================================
  203. The manual page is generated in both html and roff formats. Any web browser
  204. can be used to view the html manual. The roff manual page can be formatted
  205. prior to installation via the following command:
  206. nroff -man -t doc/jemalloc.3