Optimize memory footprint (#3376)

This commit is contained in:
Arkadiy Paronyan 2016-11-12 12:07:02 +01:00 committed by Gav Wood
parent c17ef2c1a4
commit 67fa58db14
2 changed files with 3 additions and 2 deletions

View File

@ -17,10 +17,10 @@
//! Database of byte-slices keyed to their Keccak hash. //! Database of byte-slices keyed to their Keccak hash.
use hash::*; use hash::*;
use std::collections::HashMap; use std::collections::HashMap;
use elastic_array::ElasticArray256; use elastic_array::ElasticArray128;
/// `HashDB` value type. /// `HashDB` value type.
pub type DBValue = ElasticArray256<u8>; pub type DBValue = ElasticArray128<u8>;
/// Trait modelling datastore keyed by a 32-byte Keccak hash. /// Trait modelling datastore keyed by a 32-byte Keccak hash.
pub trait HashDB: AsHashDB + Send + Sync { pub trait HashDB: AsHashDB + Send + Sync {

View File

@ -464,6 +464,7 @@ impl Database {
try!(db.write_opt(batch, &self.write_opts)); try!(db.write_opt(batch, &self.write_opts));
for column in self.flushing.write().iter_mut() { for column in self.flushing.write().iter_mut() {
column.clear(); column.clear();
column.shrink_to_fit();
} }
Ok(()) Ok(())
}, },