|
19 | 19 | //! # Features |
20 | 20 | //! |
21 | 21 | //! This library has the following features: |
22 | | -//! [`dlmalloc`](#dlmalloc-bump_alloc-and-global_alloc-use-a-custom-allocator), |
23 | | -//! [`bump_alloc`](#dlmalloc-bump_alloc-and-global_alloc-use-a-custom-allocator), |
24 | | -//! [`global_alloc`](#dlmalloc-bump_alloc-and-global_alloc-use-a-custom-allocator), and |
| 22 | +//! [`dlmalloc`](#dlmalloc-and-bump_alloc-use-a-custom-allocator), |
| 23 | +//! [`bump_alloc`](#dlmalloc-and-bump_alloc-use-a-custom-allocator), and |
25 | 24 | //! [`debug`](#debug-emit-debug-information). |
26 | 25 | //! And the following features used by tooling only: |
27 | 26 | //! [`build-schema`](#build-schema-build-for-generating-a-module-schema) and |
28 | 27 | //! [`wasm-test`](#wasm-test-build-for-testing-in-wasm), |
29 | 28 | //! |
30 | | -//! ## `dlmalloc`, `bump_alloc` and `global_alloc`: Use a custom allocator |
| 29 | +//! ## `dlmalloc` and `bump_alloc`: Use a custom allocator |
31 | 30 | //! |
32 | 31 | //! The default allocator is [`dlmalloc`](https://crates.io/crates/dlmalloc), which |
33 | 32 | //! is a general purpose allocator. For smart contracts, the lighter `bump_alloc` |
|
41 | 40 | //! tradeoff. Especially for contracts such as those dealing with tokens. |
42 | 41 | //! For very complex contracts it may be beneficial to run benchmarks to see |
43 | 42 | //! whether `bump_alloc` is the best option. It is also possible to specify |
44 | | -//! your own allocator by disabling the feature flag `global_alloc`. If the flag |
45 | | -//! is enabled, the `concordium-std` will set the global allocator. |
| 43 | +//! your own allocator by not enabling any of the `dlmalloc` and `bump_alloc` features. |
46 | 44 | //! See the Rust [allocator](https://doc.rust-lang.org/std/alloc/index.html#the-global_allocator-attribute) |
47 | 45 | //! documentation for more context and details on using custom allocators. |
48 | 46 | //! |
|
277 | 275 | //! sense to compile it with `no_std`. If you have code that conditionally should only compile |
278 | 276 | //! when WASM is the target, you can condition on the WASM target: `#[cfg(target_arch = "wasm32")]`. |
279 | 277 | //! |
280 | | -//! If you are using a custom allocator, see [this section](#dlmalloc-bump_alloc-and-global_alloc-use-a-custom-allocator) |
| 278 | +//! If you are using a custom allocator, see [this section](#dlmalloc-and-bump_alloc-use-a-custom-allocator) |
281 | 279 | //! on how to configure it. |
282 | 280 | //! |
283 | 281 | //! ## Version 8.1 |
@@ -415,20 +413,15 @@ pub use core::{cell, cmp, convert, fmt, hash, hint, iter, marker, mem, num, ops, |
415 | 413 | #[cfg(all( |
416 | 414 | feature = "dlmalloc", |
417 | 415 | not(feature = "bump_alloc"), |
418 | | - feature = "global_alloc", |
419 | 416 | target_arch = "wasm32" |
420 | 417 | ))] |
421 | 418 | #[global_allocator] |
422 | 419 | static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc; |
423 | 420 |
|
424 | | -#[cfg(all(feature = "bump_alloc", target_arch = "wasm32"))] |
| 421 | +#[cfg(target_arch = "wasm32")] |
425 | 422 | pub mod bump_alloc; |
426 | 423 |
|
427 | | -#[cfg(all( |
428 | | - feature = "bump_alloc", |
429 | | - feature = "global_alloc", |
430 | | - target_arch = "wasm32" |
431 | | -))] |
| 424 | +#[cfg(all(feature = "bump_alloc", target_arch = "wasm32"))] |
432 | 425 | #[global_allocator] |
433 | 426 | static ALLOC: bump_alloc::BumpAllocator = unsafe { bump_alloc::BumpAllocator::new() }; |
434 | 427 |
|
|
0 commit comments