You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: snmalloc-rs/README.md
+21-8Lines changed: 21 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,20 +13,14 @@ a global allocator for rust. snmalloc is a research allocator. Its key design fe
13
13
Some old benchmark results are available in
14
14
the [`snmalloc` paper](https://github.com/microsoft/snmalloc/blob/master/snmalloc.pdf).
15
15
16
-
There are three features defined in this crate:
16
+
There are the following features defined in this crate:
17
17
18
-
-`debug`: Enable the `Debug` mode in `snmalloc`.
19
-
-~~`1mib`: Use the `1mib` chunk configuration. From `0.2.17`, this is set as a default feature~~ (removed since 0.3.0)
20
-
-~~`16mib`: Use the `16mib` chunk configuration.~~ (removed since 0.3.0)
21
-
-~~`cache-friendly`: Make the allocator more cache friendly (setting `CACHE_FRIENDLY_OFFSET` to `64` in building the
22
-
library).~~ (removed since 0.3.0)
18
+
-`debug`: Enable the `Debug` mode in `snmalloc`. This is also automatically enabled if Cargo's `DEBUG` environment variable is set to `true`.
23
19
-`native-cpu`: Optimize `snmalloc` for the native CPU of the host machine. (this is not a default behavior
24
20
since `0.2.14`)
25
21
-`qemu`: Workaround `madvise` problem of QEMU environment
26
-
-~~`stats`: Enable statistics~~ (removed since 0.3.0)
27
22
-`local_dynamic_tls`: Workaround cannot allocate memory in static tls block
28
23
-`build_cc`: Use of cc crate instead of cmake (cmake still default) as builder (more platform agnostic)
29
-
-~~`usecxx20`: Enable C++20 standard if available~~ (removed since 0.3.0)
30
24
-`usecxx17`: Use C++17 standard
31
25
-`check`: Enable extra checks to improve security, see upstream [security docs](https://github.com/microsoft/snmalloc/tree/main/docs/security).
32
26
Note that the `memcpy` protection is not enabled in Rust.
@@ -35,6 +29,25 @@ There are three features defined in this crate:
35
29
-`notls`: Enables to be loaded dynamically, thus disable tls.
36
30
-`stats`: Enables allocation statistics.
37
31
-`libc-api`: Enables libc API backed by snmalloc.
32
+
-`usewait-on-address`: Enable `WaitOnAddress` support on Windows (enabled by default).
33
+
-`tracing`: Enable structured tracing/logging.
34
+
-`fuzzing`: Enable fuzzing support.
35
+
-`vendored-stl`: Use self-vendored STL.
36
+
-`check-loads`: Enable check loads feature.
37
+
-`pageid`: Enable page ID feature.
38
+
-`gwp-asan`: Enable GWP-ASan integration. Requires `SNMALLOC_GWP_ASAN_INCLUDE_PATH` and `SNMALLOC_GWP_ASAN_LIBRARY_PATH`.
39
+
40
+
## Build Configuration
41
+
42
+
The build script ensures architectural alignment between the Rust profile and the underlying `snmalloc` allocator:
43
+
44
+
### Environment Variables
45
+
The following environment variables are automatically detected and propagated:
46
+
-`DEBUG`: Synchronizes the `snmalloc` build type with the Cargo profile. If `true`, `snmalloc` is built in `Debug` mode.
47
+
-`OPT_LEVEL`: Propagated to the C++ compiler to ensure optimization parity between Rust and C++ components.
48
+
49
+
### Windows CRT Consistency
50
+
On Windows, the build script enforces static CRT linking (`/MT` or `/MTd`) across both `cc` and `cmake` builders. This prevents linker errors and ensures consistency when `snmalloc` is used as a global allocator.
38
51
39
52
**To get the crates compiled, you need to choose either `1mib` or `16mib` to determine the chunk configuration**
0 commit comments