Remove calls to heapsize (#10432)

* update memorydb trait
* use malloc_size_of instead of heapsize_of
* use jemalloc as default allocator for parity client.
This commit is contained in:
cheme
2019-06-19 13:54:05 +02:00
committed by GitHub
parent 859a41308c
commit 6fc5014b4d
84 changed files with 926 additions and 1074 deletions

View File

@@ -16,7 +16,7 @@
/// Preconfigured validator list.
use heapsize::HeapSizeOf;
use parity_util_mem::MallocSizeOf;
use ethereum_types::{H256, Address};
use machine::{AuxiliaryData, Call, EthereumMachine};
@@ -25,7 +25,7 @@ use types::header::Header;
use super::ValidatorSet;
/// Validator set containing a known set of addresses.
#[derive(Clone, Debug, PartialEq, Eq, Default)]
#[derive(Clone, Debug, PartialEq, Eq, Default, MallocSizeOf)]
pub struct SimpleList {
validators: Vec<Address>,
}
@@ -58,12 +58,6 @@ impl From<Vec<Address>> for SimpleList {
}
}
impl HeapSizeOf for SimpleList {
fn heap_size_of_children(&self) -> usize {
self.validators.heap_size_of_children()
}
}
impl ValidatorSet for SimpleList {
fn default_caller(&self, _block_id: ::types::ids::BlockId) -> Box<Call> {
Box::new(|_, _| Err("Simple list doesn't require calls.".into()))

View File

@@ -19,10 +19,10 @@
use std::str::FromStr;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
use parity_util_mem::MallocSizeOf;
use bytes::Bytes;
use ethereum_types::{H256, Address};
use heapsize::HeapSizeOf;
use types::BlockNumber;
use types::header::Header;
@@ -30,9 +30,12 @@ use machine::{AuxiliaryData, Call, EthereumMachine};
use super::{ValidatorSet, SimpleList};
/// Set used for testing with a single validator.
#[derive(MallocSizeOf)]
pub struct TestSet {
validator: SimpleList,
#[ignore_malloc_size_of = "zero sized"]
last_malicious: Arc<AtomicUsize>,
#[ignore_malloc_size_of = "zero sized"]
last_benign: Arc<AtomicUsize>,
}
@@ -52,12 +55,6 @@ impl TestSet {
}
}
impl HeapSizeOf for TestSet {
fn heap_size_of_children(&self) -> usize {
self.validator.heap_size_of_children()
}
}
impl ValidatorSet for TestSet {
fn default_caller(&self, _block_id: ::types::ids::BlockId) -> Box<Call> {
Box::new(|_, _| Err("Test set doesn't require calls.".into()))