@@ -48,11 +48,11 @@ This crate provides following cargo feature flags:
4848* ` stats ` (configure ` jemalloc ` with ` --enable-stats ` ): Enable statistics
4949 gathering functionality. See the ` jemalloc ` 's "` opt.stats_print ` " option
5050 documentation for usage details.
51-
51+
5252* ` debug ` (configure ` jemalloc ` with ` --enable-debug ` ): Enable assertions and
5353 validation code. This incurs a substantial performance hit, but is very useful
5454 during application development.
55-
55+
5656* ` background_threads_runtime_support ` (enabled by default): enables
5757 background-threads run-time support when building ` jemalloc-sys ` on some POSIX
5858 targets supported by ` jemalloc ` . Background threads are disabled at run-time
@@ -72,16 +72,33 @@ This crate provides following cargo feature flags:
7272* ` unprefixed_malloc_on_supported_platforms ` : when disabled, configure
7373 ` jemalloc ` with ` --with-jemalloc-prefix=_rjem_ ` . Enabling this causes symbols
7474 like ` malloc ` to be emitted without a prefix, overriding the ones defined by
75- libc. This usually causes C and C++ code linked in the same program to use
76- ` jemalloc ` as well. On some platforms prefixes are always used because
77- unprefixing is known to cause segfaults due to allocator mismatches.
78-
75+ libc. This usually causes C, Objective-C and C++ code linked in the same
76+ program to use ` jemalloc ` as well. On some platforms prefixes are always used
77+ because unprefixing is known to cause segfaults due to allocator mismatches.
78+
79+ * ` override_allocator_on_supported_platforms ` : override the system allocator,
80+ even outside Rust code.
81+
82+ This enables the ` unprefixed_malloc_on_supported_platforms ` feature, with the
83+ addition that it forces overriding the allocator even if ` malloc ` and ` free `
84+ would not usually have been seen by the linker. It also overrides the
85+ allocator on Apple platforms.
86+
87+ Note that to use this, the ` jemalloc-sys ` crate must actually be visible to
88+ ` rustc ` (it is not enough to only declare it in ` Cargo.toml ` ). This can be
89+ done by adding:
90+ ``` rust
91+ use jemalloc_sys as _;
92+ ```
93+
94+ In your ` main.rs ` .
95+
7996* ` disable_initial_exec_tls ` (disabled by default): when enabled, jemalloc is
80- built with the ` --disable-initial-exec-tls ` option. It disables the
81- initial-exec TLS model for jemalloc's internal thread-local storage (on those
82- platforms that support explicit settings). This can allow jemalloc to be
97+ built with the ` --disable-initial-exec-tls ` option. It disables the
98+ initial-exec TLS model for jemalloc's internal thread-local storage (on those
99+ platforms that support explicit settings). This can allow jemalloc to be
83100 dynamically loaded after program startup (e.g. using dlopen). If you encounter
84- the error ` yourlib.so: cannot allocate memory in static TLS block ` , you'll
101+ the error ` yourlib.so: cannot allocate memory in static TLS block ` , you'll
85102 likely want to enable this.
86103
87104* ` disable_cache_oblivious ` (disabled by default): when enabled, jemalloc is
@@ -104,7 +121,7 @@ hyphens `-` are replaced with underscores `_`(see
104121 variable, the ` /etc/malloc.conf ` symlink, and the ` MALLOC_CONF ` environment
105122 variable (note: this variable might be prefixed as ` _RJEM_MALLOC_CONF ` ). For
106123 example, to change the default decay time for dirty pages to 30 seconds:
107-
124+
108125 ```
109126 JEMALLOC_SYS_WITH_MALLOC_CONF=dirty_decay_ms:30000
110127 ```
@@ -115,17 +132,17 @@ hyphens `-` are replaced with underscores `_`(see
115132 allocator page size equal to the system page size, so this option need not be
116133 specified unless the system page size may change between configuration and
117134 execution, e.g. when cross compiling.
118-
135+
119136* ` JEMALLOC_SYS_WITH_LG_HUGEPAGE=<lg-hugepage> ` : Specify the base 2 log of the
120137 system huge page size. This option is useful when cross compiling, or when
121138 overriding the default for systems that do not explicitly support huge pages.
122-
123-
139+
140+
124141* ` JEMALLOC_SYS_WITH_LG_QUANTUM=<lg-quantum> ` : Specify the base 2 log of the
125142 minimum allocation alignment. jemalloc needs to know the minimum alignment
126143 that meets the following C standard requirement (quoted from the April 12,
127144 2011 draft of the C11 standard):
128-
145+
129146 > The pointer returned if the allocation succeeds is suitably aligned so that
130147 > it may be assigned to a pointer to any type of object with a fundamental
131148 > alignment requirement and then used to access such an object or an array of
0 commit comments