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:
@@ -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()))
|
||||
|
||||
@@ -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()))
|
||||
|
||||
Reference in New Issue
Block a user