2
0

INSTALL 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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. --without-export
  42. Don't export public APIs. This can be useful when building jemalloc as a
  43. static library, or to avoid exporting public APIs when using the zone
  44. allocator on OSX.
  45. --with-private-namespace=<prefix>
  46. Prefix all library-private APIs with <prefix>je_. For shared libraries,
  47. symbol visibility mechanisms prevent these symbols from being exported, but
  48. for static libraries, naming collisions are a real possibility. By
  49. default, <prefix> is empty, which results in a symbol prefix of je_ .
  50. --with-install-suffix=<suffix>
  51. Append <suffix> to the base name of all installed files, such that multiple
  52. versions of jemalloc can coexist in the same installation directory. For
  53. example, libjemalloc.so.0 becomes libjemalloc<suffix>.so.0.
  54. --enable-cc-silence
  55. Enable code that silences non-useful compiler warnings. This is helpful
  56. when trying to tell serious warnings from those due to compiler
  57. limitations, but it potentially incurs a performance penalty.
  58. --enable-debug
  59. Enable assertions and validation code. This incurs a substantial
  60. performance hit, but is very useful during application development.
  61. Implies --enable-ivsalloc.
  62. --enable-code-coverage
  63. Enable code coverage support, for use during jemalloc test development.
  64. Additional testing targets are available if this option is enabled:
  65. coverage
  66. coverage_unit
  67. coverage_integration
  68. coverage_stress
  69. These targets do not clear code coverage results from previous runs, and
  70. there are interactions between the various coverage targets, so it is
  71. usually advisable to run 'make clean' between repeated code coverage runs.
  72. --enable-ivsalloc
  73. Enable validation code, which verifies that pointers reside within
  74. jemalloc-owned chunks before dereferencing them. This incurs a substantial
  75. performance hit.
  76. --disable-stats
  77. Disable statistics gathering functionality. See the "opt.stats_print"
  78. option documentation for usage details.
  79. --enable-prof
  80. Enable heap profiling and leak detection functionality. See the "opt.prof"
  81. option documentation for usage details. When enabled, there are several
  82. approaches to backtracing, and the configure script chooses the first one
  83. in the following list that appears to function correctly:
  84. + libunwind (requires --enable-prof-libunwind)
  85. + libgcc (unless --disable-prof-libgcc)
  86. + gcc intrinsics (unless --disable-prof-gcc)
  87. --enable-prof-libunwind
  88. Use the libunwind library (http://www.nongnu.org/libunwind/) for stack
  89. backtracing.
  90. --disable-prof-libgcc
  91. Disable the use of libgcc's backtracing functionality.
  92. --disable-prof-gcc
  93. Disable the use of gcc intrinsics for backtracing.
  94. --with-static-libunwind=<libunwind.a>
  95. Statically link against the specified libunwind.a rather than dynamically
  96. linking with -lunwind.
  97. --disable-tcache
  98. Disable thread-specific caches for small objects. Objects are cached and
  99. released in bulk, thus reducing the total number of mutex operations. See
  100. the "opt.tcache" option for usage details.
  101. --enable-mremap
  102. Enable huge realloc() via mremap(2). mremap() is disabled by default
  103. because the flavor used is specific to Linux, which has a quirk in its
  104. virtual memory allocation algorithm that causes semi-permanent VM map holes
  105. under normal jemalloc operation.
  106. --disable-munmap
  107. Disable virtual memory deallocation via munmap(2); instead keep track of
  108. the virtual memory for later use. munmap() is disabled by default (i.e.
  109. --disable-munmap is implied) on Linux, which has a quirk in its virtual
  110. memory allocation algorithm that causes semi-permanent VM map holes under
  111. normal jemalloc operation.
  112. --enable-dss
  113. Enable support for page allocation/deallocation via sbrk(2), in addition to
  114. mmap(2).
  115. --disable-fill
  116. Disable support for junk/zero filling of memory, quarantine, and redzones.
  117. See the "opt.junk", "opt.zero", "opt.quarantine", and "opt.redzone" option
  118. documentation for usage details.
  119. --disable-valgrind
  120. Disable support for Valgrind.
  121. --disable-experimental
  122. Disable support for the experimental API (*allocm()).
  123. --disable-zone-allocator
  124. Disable zone allocator for Darwin. This means jemalloc won't be hooked as
  125. the default allocator on OSX/iOS.
  126. --enable-utrace
  127. Enable utrace(2)-based allocation tracing. This feature is not broadly
  128. portable (FreeBSD has it, but Linux and OS X do not).
  129. --enable-xmalloc
  130. Enable support for optional immediate termination due to out-of-memory
  131. errors, as is commonly implemented by "xmalloc" wrapper function for malloc.
  132. See the "opt.xmalloc" option documentation for usage details.
  133. --enable-lazy-lock
  134. Enable code that wraps pthread_create() to detect when an application
  135. switches from single-threaded to multi-threaded mode, so that it can avoid
  136. mutex locking/unlocking operations while in single-threaded mode. In
  137. practice, this feature usually has little impact on performance unless
  138. thread-specific caching is disabled.
  139. --disable-tls
  140. Disable thread-local storage (TLS), which allows for fast access to
  141. thread-local variables via the __thread keyword. If TLS is available,
  142. jemalloc uses it for several purposes.
  143. --with-xslroot=<path>
  144. Specify where to find DocBook XSL stylesheets when building the
  145. documentation.
  146. The following environment variables (not a definitive list) impact configure's
  147. behavior:
  148. CFLAGS="?"
  149. Pass these flags to the compiler. You probably shouldn't define this unless
  150. you know what you are doing. (Use EXTRA_CFLAGS instead.)
  151. EXTRA_CFLAGS="?"
  152. Append these flags to CFLAGS. This makes it possible to add flags such as
  153. -Werror, while allowing the configure script to determine what other flags
  154. are appropriate for the specified configuration.
  155. The configure script specifically checks whether an optimization flag (-O*)
  156. is specified in EXTRA_CFLAGS, and refrains from specifying an optimization
  157. level if it finds that one has already been specified.
  158. CPPFLAGS="?"
  159. Pass these flags to the C preprocessor. Note that CFLAGS is not passed to
  160. 'cpp' when 'configure' is looking for include files, so you must use
  161. CPPFLAGS instead if you need to help 'configure' find header files.
  162. LD_LIBRARY_PATH="?"
  163. 'ld' uses this colon-separated list to find libraries.
  164. LDFLAGS="?"
  165. Pass these flags when linking.
  166. PATH="?"
  167. 'configure' uses this to find programs.
  168. === Advanced compilation =======================================================
  169. To build only parts of jemalloc, use the following targets:
  170. build_lib_shared
  171. build_lib_static
  172. build_lib
  173. build_doc_html
  174. build_doc_man
  175. build_doc
  176. To install only parts of jemalloc, use the following targets:
  177. install_bin
  178. install_include
  179. install_lib_shared
  180. install_lib_static
  181. install_lib
  182. install_doc_html
  183. install_doc_man
  184. install_doc
  185. To clean up build results to varying degrees, use the following make targets:
  186. clean
  187. distclean
  188. relclean
  189. === Advanced installation ======================================================
  190. Optionally, define make variables when invoking make, including (not
  191. exclusively):
  192. INCLUDEDIR="?"
  193. Use this as the installation prefix for header files.
  194. LIBDIR="?"
  195. Use this as the installation prefix for libraries.
  196. MANDIR="?"
  197. Use this as the installation prefix for man pages.
  198. DESTDIR="?"
  199. Prepend DESTDIR to INCLUDEDIR, LIBDIR, DATADIR, and MANDIR. This is useful
  200. when installing to a different path than was specified via --prefix.
  201. CC="?"
  202. Use this to invoke the C compiler.
  203. CFLAGS="?"
  204. Pass these flags to the compiler.
  205. CPPFLAGS="?"
  206. Pass these flags to the C preprocessor.
  207. LDFLAGS="?"
  208. Pass these flags when linking.
  209. PATH="?"
  210. Use this to search for programs used during configuration and building.
  211. === Development ================================================================
  212. If you intend to make non-trivial changes to jemalloc, use the 'autogen.sh'
  213. script rather than 'configure'. This re-generates 'configure', enables
  214. configuration dependency rules, and enables re-generation of automatically
  215. generated source files.
  216. The build system supports using an object directory separate from the source
  217. tree. For example, you can create an 'obj' directory, and from within that
  218. directory, issue configuration and build commands:
  219. autoconf
  220. mkdir obj
  221. cd obj
  222. ../configure --enable-autogen
  223. make
  224. === Documentation ==============================================================
  225. The manual page is generated in both html and roff formats. Any web browser
  226. can be used to view the html manual. The roff manual page can be formatted
  227. prior to installation via the following command:
  228. nroff -man -t doc/jemalloc.3