@@ -48,11 +48,11 @@ This crate provides following cargo feature flags:
48
48
* ` stats ` (configure ` jemalloc ` with ` --enable-stats ` ): Enable statistics
49
49
gathering functionality. See the ` jemalloc ` 's "` opt.stats_print ` " option
50
50
documentation for usage details.
51
-
51
+
52
52
* ` debug ` (configure ` jemalloc ` with ` --enable-debug ` ): Enable assertions and
53
53
validation code. This incurs a substantial performance hit, but is very useful
54
54
during application development.
55
-
55
+
56
56
* ` background_threads_runtime_support ` (enabled by default): enables
57
57
background-threads run-time support when building ` jemalloc-sys ` on some POSIX
58
58
targets supported by ` jemalloc ` . Background threads are disabled at run-time
@@ -72,16 +72,25 @@ This crate provides following cargo feature flags:
72
72
* ` unprefixed_malloc_on_supported_platforms ` : when disabled, configure
73
73
` jemalloc ` with ` --with-jemalloc-prefix=_rjem_ ` . Enabling this causes symbols
74
74
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
+ Note that to use this, the ` jemalloc-sys ` crate must actually be visible to
80
+ ` rustc ` (it is not enough to only declare it in ` Cargo.toml ` ). This can be
81
+ done by adding:
82
+ ``` rust
83
+ use jemalloc_sys as _;
84
+ ```
85
+
86
+ In your ` main.rs ` .
87
+
79
88
* ` 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
89
+ built with the ` --disable-initial-exec-tls ` option. It disables the
90
+ initial-exec TLS model for jemalloc's internal thread-local storage (on those
91
+ platforms that support explicit settings). This can allow jemalloc to be
83
92
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
93
+ the error ` yourlib.so: cannot allocate memory in static TLS block ` , you'll
85
94
likely want to enable this.
86
95
87
96
* ` disable_cache_oblivious ` (disabled by default): when enabled, jemalloc is
@@ -104,7 +113,7 @@ hyphens `-` are replaced with underscores `_`(see
104
113
variable, the ` /etc/malloc.conf ` symlink, and the ` MALLOC_CONF ` environment
105
114
variable (note: this variable might be prefixed as ` _RJEM_MALLOC_CONF ` ). For
106
115
example, to change the default decay time for dirty pages to 30 seconds:
107
-
116
+
108
117
```
109
118
JEMALLOC_SYS_WITH_MALLOC_CONF=dirty_decay_ms:30000
110
119
```
@@ -115,17 +124,17 @@ hyphens `-` are replaced with underscores `_`(see
115
124
allocator page size equal to the system page size, so this option need not be
116
125
specified unless the system page size may change between configuration and
117
126
execution, e.g. when cross compiling.
118
-
127
+
119
128
* ` JEMALLOC_SYS_WITH_LG_HUGEPAGE=<lg-hugepage> ` : Specify the base 2 log of the
120
129
system huge page size. This option is useful when cross compiling, or when
121
130
overriding the default for systems that do not explicitly support huge pages.
122
-
123
-
131
+
132
+
124
133
* ` JEMALLOC_SYS_WITH_LG_QUANTUM=<lg-quantum> ` : Specify the base 2 log of the
125
134
minimum allocation alignment. jemalloc needs to know the minimum alignment
126
135
that meets the following C standard requirement (quoted from the April 12,
127
136
2011 draft of the C11 standard):
128
-
137
+
129
138
> The pointer returned if the allocation succeeds is suitably aligned so that
130
139
> it may be assigned to a pointer to any type of object with a fundamental
131
140
> alignment requirement and then used to access such an object or an array of
0 commit comments