Use system allocator when profiling memory (#8831)

This commit is contained in:
Andronik Ordian
2018-06-07 17:48:01 +03:00
committed by Afri Schoedon
parent a6d267abc0
commit 24c43513a6
2 changed files with 17 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
//! Ethcore client application.
#![warn(missing_docs)]
#![cfg_attr(feature = "memory_profiling", feature(alloc_system, global_allocator, allocator_api))]
extern crate ansi_term;
extern crate docopt;
@@ -91,6 +92,9 @@ extern crate pretty_assertions;
#[cfg(test)]
extern crate tempdir;
#[cfg(feature = "memory_profiling")]
extern crate alloc_system;
mod account;
mod blockchain;
mod cache;
@@ -125,10 +129,16 @@ use cli::Args;
use configuration::{Cmd, Execute};
use deprecated::find_deprecated;
use ethcore_logger::setup_log;
#[cfg(feature = "memory_profiling")]
use alloc_system::System;
pub use self::configuration::Configuration;
pub use self::run::RunningClient;
#[cfg(feature = "memory_profiling")]
#[global_allocator]
static A: System = System;
fn print_hash_of(maybe_file: Option<String>) -> Result<String, String> {
if let Some(file) = maybe_file {
let mut f = BufReader::new(File::open(&file).map_err(|_| "Unable to open file".to_owned())?);