Added modern instructions
This commit is contained in:
parent
d5fccc7fca
commit
7e95293b29
11
README.md
11
README.md
|
@ -25,16 +25,21 @@ To use `jemallocator` add it as a dependency:
|
||||||
```toml
|
```toml
|
||||||
# Cargo.toml
|
# Cargo.toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
jemallocator = "0.3.0"
|
|
||||||
|
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
||||||
|
jemallocator = "0.3.2"
|
||||||
```
|
```
|
||||||
|
|
||||||
To set `jemallocator::Jemalloc` as the global allocator add this to your project:
|
To set `jemallocator::Jemalloc` as the global allocator add this to your project:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate jemallocator;
|
# main.rs
|
||||||
|
#[cfg(not(target_env = "msvc"))]
|
||||||
|
use jemallocator::Jemalloc;
|
||||||
|
|
||||||
|
#[cfg(not(target_env = "msvc"))]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
static GLOBAL: Jemalloc = Jemalloc;
|
||||||
```
|
```
|
||||||
|
|
||||||
And that's it! Once you've defined this `static` then jemalloc will be used for
|
And that's it! Once you've defined this `static` then jemalloc will be used for
|
||||||
|
|
Loading…
Reference in New Issue