diff --git a/Cargo.lock b/Cargo.lock
index e2108d186..fba56d466 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -301,6 +301,7 @@ dependencies = [
"bloomable 0.1.0",
"ethcore-util 1.8.0",
"ethjson 0.1.0",
+ "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0",
"rlp_derive 0.1.0",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -516,6 +517,7 @@ dependencies = [
"evm 0.1.0",
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hardware-wallet 1.8.0",
+ "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)",
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -652,6 +654,7 @@ dependencies = [
"ethcore-util 1.8.0",
"evm 0.1.0",
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -920,6 +923,7 @@ dependencies = [
"ethcore-util 1.8.0",
"ethjson 0.1.0",
"evmjit 1.8.0",
+ "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-wasm 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml
index c49e31898..71d91df06 100644
--- a/ethcore/Cargo.toml
+++ b/ethcore/Cargo.toml
@@ -35,6 +35,7 @@ ethstore = { path = "../ethstore" }
evm = { path = "evm" }
futures = "0.1"
hardware-wallet = { path = "../hw" }
+heapsize = "0.4"
hyper = { git = "https://github.com/paritytech/hyper", default-features = false }
itertools = "0.5"
lazy_static = "0.2"
diff --git a/ethcore/evm/Cargo.toml b/ethcore/evm/Cargo.toml
index 2780703da..c3f9c03b9 100644
--- a/ethcore/evm/Cargo.toml
+++ b/ethcore/evm/Cargo.toml
@@ -10,6 +10,7 @@ common-types = { path = "../types" }
ethcore-util = { path = "../../util" }
evmjit = { path = "../../evmjit", optional = true }
ethjson = { path = "../../json" }
+heapsize = "0.4"
lazy_static = "0.2"
log = "0.3"
rlp = { path = "../../util/rlp" }
diff --git a/ethcore/evm/src/interpreter/shared_cache.rs b/ethcore/evm/src/interpreter/shared_cache.rs
index a93afa79a..b582ce8a5 100644
--- a/ethcore/evm/src/interpreter/shared_cache.rs
+++ b/ethcore/evm/src/interpreter/shared_cache.rs
@@ -15,7 +15,8 @@
// along with Parity. If not, see .
use std::sync::Arc;
-use util::{H256, HeapSizeOf, Mutex};
+use heapsize::HeapSizeOf;
+use util::{H256, Mutex};
use util::sha3::*;
use util::cache::MemoryLruCache;
use bit_set::BitSet;
diff --git a/ethcore/evm/src/lib.rs b/ethcore/evm/src/lib.rs
index 833b26664..77d4f7c04 100644
--- a/ethcore/evm/src/lib.rs
+++ b/ethcore/evm/src/lib.rs
@@ -25,6 +25,7 @@ extern crate rlp;
extern crate parity_wasm;
extern crate wasm_utils;
extern crate ethcore_logger;
+extern crate heapsize;
extern crate vm;
#[macro_use]
diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml
index 9fda78f47..5ee90567d 100644
--- a/ethcore/light/Cargo.toml
+++ b/ethcore/light/Cargo.toml
@@ -19,6 +19,7 @@ ethcore-io = { path = "../../util/io" }
ethcore-ipc = { path = "../../ipc/rpc", optional = true }
ethcore-devtools = { path = "../../devtools" }
evm = { path = "../evm" }
+heapsize = "0.4"
vm = { path = "../vm" }
rlp = { path = "../../util/rlp" }
rlp_derive = { path = "../../util/rlp_derive" }
diff --git a/ethcore/light/src/cache.rs b/ethcore/light/src/cache.rs
index 9a5a3638f..ab416e9b3 100644
--- a/ethcore/light/src/cache.rs
+++ b/ethcore/light/src/cache.rs
@@ -26,7 +26,8 @@ use ethcore::receipt::Receipt;
use stats::Corpus;
use time::{SteadyTime, Duration};
-use util::{U256, H256, HeapSizeOf};
+use heapsize::HeapSizeOf;
+use util::{U256, H256};
use util::cache::MemoryLruCache;
/// Configuration for how much data to cache.
diff --git a/ethcore/light/src/client/header_chain.rs b/ethcore/light/src/client/header_chain.rs
index d6ac109c7..554d0f005 100644
--- a/ethcore/light/src/client/header_chain.rs
+++ b/ethcore/light/src/client/header_chain.rs
@@ -36,7 +36,8 @@ use ethcore::header::Header;
use ethcore::ids::BlockId;
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp, UntrustedRlp};
-use util::{H256, U256, HeapSizeOf, RwLock};
+use heapsize::HeapSizeOf;
+use util::{H256, U256, RwLock};
use util::kvdb::{DBTransaction, KeyValueDB};
use cache::Cache;
diff --git a/ethcore/light/src/client/mod.rs b/ethcore/light/src/client/mod.rs
index d1cdfe9aa..ee270c977 100644
--- a/ethcore/light/src/client/mod.rs
+++ b/ethcore/light/src/client/mod.rs
@@ -330,7 +330,7 @@ impl Client {
/// Get blockchain mem usage in bytes.
pub fn chain_mem_used(&self) -> usize {
- use util::HeapSizeOf;
+ use heapsize::HeapSizeOf;
self.chain.heap_size_of_children()
}
diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs
index c2ab483d2..780ea3043 100644
--- a/ethcore/light/src/lib.rs
+++ b/ethcore/light/src/lib.rs
@@ -72,6 +72,7 @@ extern crate ethcore_network as network;
extern crate ethcore_util as util;
extern crate ethcore;
extern crate evm;
+extern crate heapsize;
extern crate futures;
extern crate itertools;
extern crate rand;
diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs
index 001df861c..29d12009a 100644
--- a/ethcore/src/blockchain/blockchain.rs
+++ b/ethcore/src/blockchain/blockchain.rs
@@ -21,6 +21,7 @@ use std::sync::Arc;
use std::mem;
use itertools::Itertools;
use bloomchain as bc;
+use heapsize::HeapSizeOf;
use util::*;
use rlp::*;
use header::*;
diff --git a/ethcore/src/blockchain/extras.rs b/ethcore/src/blockchain/extras.rs
index 0e2396f8c..69e623a1f 100644
--- a/ethcore/src/blockchain/extras.rs
+++ b/ethcore/src/blockchain/extras.rs
@@ -25,7 +25,8 @@ use engines::epoch::{Transition as EpochTransition};
use header::BlockNumber;
use receipt::Receipt;
-use util::{HeapSizeOf, H256, H264, U256};
+use heapsize::HeapSizeOf;
+use util::{H256, H264, U256};
use util::kvdb::PREFIX_LEN as DB_PREFIX_LEN;
/// Represents index of extra data in database
diff --git a/ethcore/src/blooms/bloom.rs b/ethcore/src/blooms/bloom.rs
index c79091cb4..f32fc5359 100644
--- a/ethcore/src/blooms/bloom.rs
+++ b/ethcore/src/blooms/bloom.rs
@@ -15,7 +15,7 @@
// along with Parity. If not, see .
use bloomchain as bc;
-use util::HeapSizeOf;
+use heapsize::HeapSizeOf;
use basic_types::LogBloom;
/// Helper structure representing bloom of the trace.
diff --git a/ethcore/src/blooms/bloom_group.rs b/ethcore/src/blooms/bloom_group.rs
index 087f20b6f..1867b7ecc 100644
--- a/ethcore/src/blooms/bloom_group.rs
+++ b/ethcore/src/blooms/bloom_group.rs
@@ -16,7 +16,7 @@
use bloomchain::group as bc;
use rlp::*;
-use util::HeapSizeOf;
+use heapsize::HeapSizeOf;
use super::Bloom;
/// Represents group of X consecutive blooms.
diff --git a/ethcore/src/blooms/group_position.rs b/ethcore/src/blooms/group_position.rs
index bb28b3c1c..b1ea82792 100644
--- a/ethcore/src/blooms/group_position.rs
+++ b/ethcore/src/blooms/group_position.rs
@@ -15,7 +15,7 @@
// along with Parity. If not, see .
use bloomchain::group as bc;
-use util::HeapSizeOf;
+use heapsize::HeapSizeOf;
/// Represents `BloomGroup` position in database.
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
diff --git a/ethcore/src/encoded.rs b/ethcore/src/encoded.rs
index 125a00fd0..374a946db 100644
--- a/ethcore/src/encoded.rs
+++ b/ethcore/src/encoded.rs
@@ -28,7 +28,8 @@ use header::{BlockNumber, Header as FullHeader};
use transaction::UnverifiedTransaction;
use views;
-use util::{Address, Hashable, H256, H2048, U256, HeapSizeOf};
+use heapsize::HeapSizeOf;
+use util::{Address, Hashable, H256, H2048, U256};
use rlp::Rlp;
/// Owning header view.
diff --git a/ethcore/src/engines/validator_set/simple_list.rs b/ethcore/src/engines/validator_set/simple_list.rs
index 8b8d1942d..40cbe4e93 100644
--- a/ethcore/src/engines/validator_set/simple_list.rs
+++ b/ethcore/src/engines/validator_set/simple_list.rs
@@ -16,7 +16,8 @@
/// Preconfigured validator list.
-use util::{H256, Address, HeapSizeOf};
+use heapsize::HeapSizeOf;
+use util::{H256, Address};
use engines::{Call, Engine};
use header::{BlockNumber, Header};
diff --git a/ethcore/src/engines/validator_set/test.rs b/ethcore/src/engines/validator_set/test.rs
index 25eeff66e..92472d743 100644
--- a/ethcore/src/engines/validator_set/test.rs
+++ b/ethcore/src/engines/validator_set/test.rs
@@ -19,7 +19,8 @@
use std::str::FromStr;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
-use util::{Bytes, H256, Address, HeapSizeOf};
+use heapsize::HeapSizeOf;
+use util::{Bytes, H256, Address};
use engines::{Call, Engine};
use header::{Header, BlockNumber};
diff --git a/ethcore/src/header.rs b/ethcore/src/header.rs
index a9a4f948d..77cdd54af 100644
--- a/ethcore/src/header.rs
+++ b/ethcore/src/header.rs
@@ -18,6 +18,7 @@
use std::cmp;
use std::cell::RefCell;
+use heapsize::HeapSizeOf;
use util::*;
use basic_types::{LogBloom, ZERO_LOGBLOOM};
use time::get_time;
diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs
index 15d44626b..ddeb5c73e 100644
--- a/ethcore/src/lib.rs
+++ b/ethcore/src/lib.rs
@@ -101,6 +101,7 @@ extern crate num;
extern crate price_info;
extern crate rand;
extern crate rlp;
+extern crate heapsize;
#[macro_use]
extern crate rlp_derive;
diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs
index 00029e70f..5b29a1607 100644
--- a/ethcore/src/miner/transaction_queue.rs
+++ b/ethcore/src/miner/transaction_queue.rs
@@ -105,7 +105,8 @@ use std::cmp::Ordering;
use std::cmp;
use std::collections::{HashSet, HashMap, BTreeSet, BTreeMap};
use linked_hash_map::LinkedHashMap;
-use util::{Address, H256, U256, HeapSizeOf};
+use heapsize::HeapSizeOf;
+use util::{Address, H256, U256};
use table::Table;
use transaction::*;
use error::{Error, TransactionError};
diff --git a/ethcore/src/trace/db.rs b/ethcore/src/trace/db.rs
index 5199fe0cd..0fe057a64 100644
--- a/ethcore/src/trace/db.rs
+++ b/ethcore/src/trace/db.rs
@@ -20,7 +20,8 @@ use std::collections::{HashMap, VecDeque};
use std::sync::Arc;
use bloomchain::{Number, Config as BloomConfig};
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
-use util::{H256, H264, KeyValueDB, DBTransaction, RwLock, HeapSizeOf};
+use heapsize::HeapSizeOf;
+use util::{H256, H264, KeyValueDB, DBTransaction, RwLock};
use header::BlockNumber;
use trace::{LocalizedTrace, Config, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras};
use db::{self, Key, Writable, Readable, CacheUpdatePolicy};
diff --git a/ethcore/src/trace/types/flat.rs b/ethcore/src/trace/types/flat.rs
index 138d69f03..0ea8ede27 100644
--- a/ethcore/src/trace/types/flat.rs
+++ b/ethcore/src/trace/types/flat.rs
@@ -18,7 +18,7 @@
use std::collections::VecDeque;
use rlp::*;
-use util::HeapSizeOf;
+use heapsize::HeapSizeOf;
use basic_types::LogBloom;
use super::trace::{Action, Res};
diff --git a/ethcore/src/transaction.rs b/ethcore/src/transaction.rs
index 0bd61dceb..636fb89d0 100644
--- a/ethcore/src/transaction.rs
+++ b/ethcore/src/transaction.rs
@@ -19,7 +19,8 @@
use std::ops::Deref;
use rlp::*;
use util::sha3::Hashable;
-use util::{H256, Address, U256, Bytes, HeapSizeOf};
+use heapsize::HeapSizeOf;
+use util::{H256, Address, U256, Bytes};
use ethkey::{Signature, Secret, Public, recover, public_to_address, Error as EthkeyError};
use error::*;
use evm::Schedule;
diff --git a/ethcore/src/verification/queue/kind.rs b/ethcore/src/verification/queue/kind.rs
index 6ab6d692e..4b547c1b7 100644
--- a/ethcore/src/verification/queue/kind.rs
+++ b/ethcore/src/verification/queue/kind.rs
@@ -19,7 +19,8 @@
use engines::Engine;
use error::Error;
-use util::{HeapSizeOf, H256, U256};
+use heapsize::HeapSizeOf;
+use util::{H256, U256};
pub use self::blocks::Blocks;
pub use self::headers::Headers;
@@ -72,7 +73,8 @@ pub mod blocks {
use header::Header;
use verification::{PreverifiedBlock, verify_block_basic, verify_block_unordered};
- use util::{Bytes, HeapSizeOf, H256, U256};
+ use heapsize::HeapSizeOf;
+ use util::{Bytes, H256, U256};
/// A mode for verifying blocks.
pub struct Blocks;
diff --git a/ethcore/src/verification/queue/mod.rs b/ethcore/src/verification/queue/mod.rs
index ce0cb4179..8fc4a5919 100644
--- a/ethcore/src/verification/queue/mod.rs
+++ b/ethcore/src/verification/queue/mod.rs
@@ -22,6 +22,7 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrdering};
use std::sync::{Condvar as SCondvar, Mutex as SMutex, Arc};
use std::cmp;
use std::collections::{VecDeque, HashSet, HashMap};
+use heapsize::HeapSizeOf;
use util::*;
use io::*;
use error::*;
diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs
index 00976dca7..5e86fba9d 100644
--- a/ethcore/src/verification/verification.rs
+++ b/ethcore/src/verification/verification.rs
@@ -22,6 +22,7 @@
//! 3. Final verification against the blockchain done before enactment.
use std::collections::HashSet;
+use heapsize::HeapSizeOf;
use util::*;
use engines::Engine;
use error::{BlockError, Error};
diff --git a/ethcore/types/Cargo.toml b/ethcore/types/Cargo.toml
index 82963f960..85a5dfa98 100644
--- a/ethcore/types/Cargo.toml
+++ b/ethcore/types/Cargo.toml
@@ -10,6 +10,7 @@ rlp_derive = { path = "../../util/rlp_derive" }
ethcore-util = { path = "../../util" }
ethjson = { path = "../../json" }
bloomable = { path = "../../util/bloomable" }
+heapsize = "0.4"
[dev-dependencies]
rustc-hex= "1.0"
diff --git a/ethcore/types/src/lib.rs b/ethcore/types/src/lib.rs
index 10a4ac71e..1143b0d90 100644
--- a/ethcore/types/src/lib.rs
+++ b/ethcore/types/src/lib.rs
@@ -22,6 +22,7 @@ extern crate rlp;
#[macro_use]
extern crate rlp_derive;
extern crate bloomable;
+extern crate heapsize;
#[cfg(test)]
extern crate rustc_hex;
diff --git a/ethcore/types/src/log_entry.rs b/ethcore/types/src/log_entry.rs
index 152b48a0e..058174d8b 100644
--- a/ethcore/types/src/log_entry.rs
+++ b/ethcore/types/src/log_entry.rs
@@ -17,7 +17,8 @@
//! Log entry type definition.
use std::ops::Deref;
-use util::{H256, Address, Bytes, HeapSizeOf, Hashable};
+use heapsize::HeapSizeOf;
+use util::{H256, Address, Bytes, Hashable};
use bloomable::Bloomable;
use {BlockNumber};
diff --git a/ethcore/types/src/receipt.rs b/ethcore/types/src/receipt.rs
index 81439ecdf..63a122179 100644
--- a/ethcore/types/src/receipt.rs
+++ b/ethcore/types/src/receipt.rs
@@ -17,7 +17,7 @@
//! Receipt
use util::{H256, U256, Address};
-use util::HeapSizeOf;
+use heapsize::HeapSizeOf;
use rlp::*;
use {BlockNumber};
diff --git a/sync/src/block_sync.rs b/sync/src/block_sync.rs
index 92c8df429..9bed9b906 100644
--- a/sync/src/block_sync.rs
+++ b/sync/src/block_sync.rs
@@ -20,6 +20,7 @@
use std::collections::{HashSet, VecDeque};
use std::cmp;
+use heapsize::HeapSizeOf;
use util::*;
use rlp::*;
use ethcore::views::{BlockView};
diff --git a/sync/src/blocks.rs b/sync/src/blocks.rs
index dbd797007..8f1425145 100644
--- a/sync/src/blocks.rs
+++ b/sync/src/blocks.rs
@@ -17,6 +17,7 @@
use std::collections::{HashSet, HashMap};
use std::collections::hash_map::Entry;
use smallvec::SmallVec;
+use heapsize::HeapSizeOf;
use util::*;
use rlp::*;
use network::NetworkError;
diff --git a/sync/src/chain.rs b/sync/src/chain.rs
index 3a472c88f..d5ed7a517 100644
--- a/sync/src/chain.rs
+++ b/sync/src/chain.rs
@@ -91,6 +91,7 @@
use std::collections::{HashSet, HashMap};
use std::cmp;
+use heapsize::HeapSizeOf;
use util::*;
use rlp::*;
use network::*;
diff --git a/util/src/lib.rs b/util/src/lib.rs
index 46730fe9c..54d624a65 100644
--- a/util/src/lib.rs
+++ b/util/src/lib.rs
@@ -151,7 +151,6 @@ pub use bigint::prelude::*;
pub use bigint::hash;
pub use ansi_term::{Colour, Style};
-pub use heapsize::HeapSizeOf;
pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
/// 160-bit integer representing account address