Skip to content

Commit

Permalink
parity-util-mem: define the default allocator explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian committed Mar 23, 2020
1 parent 939151e commit c97538a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions parity-util-mem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog].
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]
### Breaking
- Explicitly specify the default global allocator. [#363](https://github.com/paritytech/parity-common/pull/363)

## [0.6.0] - 2020-03-13
- Updated dependencies. [#361](https://github.com/paritytech/parity-common/pull/361)
Expand Down
8 changes: 7 additions & 1 deletion parity-util-mem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ cfg_if::cfg_if! {
/// Global allocator
#[global_allocator]
pub static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
} else {
} else if #[cfg(feature = "std")] {
// default allocator used
use std::alloc;
// We define it explicitly to prevent specifiying a global allocator
// ouside of this library.
/// Global allocator
#[global_allocator]
pub static ALLOC: alloc::System = alloc::System;
}
}

Expand Down

0 comments on commit c97538a

Please sign in to comment.