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
@@ -18,20 +18,14 @@ a global allocator for rust. snmalloc is a research allocator. Its key design fe
18
18
Some old benchmark results are available in
19
19
the [`snmalloc` paper](https://github.com/microsoft/snmalloc/blob/master/snmalloc.pdf). Some recent benchmark results
20
20
are listed at
21
-
[bench_suite](https://github.com/SchrodingerZhu/bench_suite). There are three features defined in this crate:
21
+
[bench_suite](https://github.com/SchrodingerZhu/bench_suite). There are following features defined in this crate:
22
22
23
-
-`debug`: Enable the `Debug` mode in `snmalloc`.
24
-
-~~`1mib`: Use the `1mib` chunk configuration. From `0.2.17`, this is set as a default feature~~ (removed since 0.3.0)
25
-
-~~`16mib`: Use the `16mib` chunk configuration.~~ (removed since 0.3.0)
26
-
-~~`cache-friendly`: Make the allocator more cache friendly (setting `CACHE_FRIENDLY_OFFSET` to `64` in building the
27
-
library).~~ (removed since 0.3.0)
23
+
-`debug`: Enable the `Debug` mode in `snmalloc`. This is also automatically enabled if Cargo's `DEBUG` environment variable is set to `true`.
28
24
-`native-cpu`: Optimize `snmalloc` for the native CPU of the host machine. (this is not a default behavior
29
25
since `0.2.14`)
30
26
-`qemu`: Workaround `madvise` problem of QEMU environment
31
-
-~~`stats`: Enable statistics~~ (removed since 0.3.0)
32
27
-`local_dynamic_tls`: Workaround cannot allocate memory in static tls block
33
28
-`build_cc`: Use of cc crate instead of cmake (cmake still default) as builder (more platform agnostic)
34
-
-~~`usecxx20`: Enable C++20 standard if available~~ (removed since 0.3.0)
35
29
-`usecxx17`: Use C++17 standard
36
30
-`check`: Enable extra checks to improve security, see upstream [security docs](https://github.com/microsoft/snmalloc/tree/main/docs/security).
37
31
Note that the `memcpy` protection is not enabled in Rust.
@@ -40,6 +34,25 @@ are listed at
40
34
-`notls`: Enables to be loaded dynamically, thus disable tls.
41
35
-`stats`: Enables allocation statistics.
42
36
-`libc-api`: Enables libc API backed by snmalloc.
37
+
-`usewait-on-address`: Enable `WaitOnAddress` support on Windows (enabled by default).
38
+
-`tracing`: Enable structured tracing/logging.
39
+
-`fuzzing`: Enable fuzzing support.
40
+
-`vendored-stl`: Use self-vendored STL.
41
+
-`check-loads`: Enable check loads feature.
42
+
-`pageid`: Enable page ID feature.
43
+
-`gwp-asan`: Enable GWP-ASan integration. Requires `SNMALLOC_GWP_ASAN_INCLUDE_PATH` and `SNMALLOC_GWP_ASAN_LIBRARY_PATH`.
44
+
45
+
## Build Configuration
46
+
47
+
The build script ensures architectural alignment between the Rust profile and the underlying `snmalloc` allocator:
48
+
49
+
### Environment Variables
50
+
The following environment variables are automatically detected and propagated:
51
+
-`DEBUG`: Synchronizes the `snmalloc` build type with the Cargo profile. If `true`, `snmalloc` is built in `Debug` mode.
52
+
-`OPT_LEVEL`: Propagated to the C++ compiler to ensure optimization parity between Rust and C++ components.
53
+
54
+
### Windows CRT Consistency
55
+
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.
43
56
44
57
**To get the crates compiled, you need to choose either `1mib` or `16mib` to determine the chunk configuration**
0 commit comments