Skip to content

Commit

Permalink
Added modern instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelOnFira authored and gnzlbg committed Oct 10, 2019
1 parent d5fccc7 commit 7e95293
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@ To use `jemallocator` add it as a dependency:
```toml
# Cargo.toml
[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:

```rust
extern crate jemallocator;
# main.rs
#[cfg(not(target_env = "msvc"))]
use jemallocator::Jemalloc;

#[cfg(not(target_env = "msvc"))]
#[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
Expand Down

0 comments on commit 7e95293

Please sign in to comment.