From 67fa58db14b935566670e0260675f86830ed9835 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Sat, 12 Nov 2016 12:07:02 +0100 Subject: [PATCH] Optimize memory footprint (#3376) --- util/src/hashdb.rs | 4 ++-- util/src/kvdb.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/util/src/hashdb.rs b/util/src/hashdb.rs index 395a504de..671b32ed5 100644 --- a/util/src/hashdb.rs +++ b/util/src/hashdb.rs @@ -17,10 +17,10 @@ //! Database of byte-slices keyed to their Keccak hash. use hash::*; use std::collections::HashMap; -use elastic_array::ElasticArray256; +use elastic_array::ElasticArray128; /// `HashDB` value type. -pub type DBValue = ElasticArray256; +pub type DBValue = ElasticArray128; /// Trait modelling datastore keyed by a 32-byte Keccak hash. pub trait HashDB: AsHashDB + Send + Sync { diff --git a/util/src/kvdb.rs b/util/src/kvdb.rs index d4d235fdc..8be22e0aa 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -464,6 +464,7 @@ impl Database { try!(db.write_opt(batch, &self.write_opts)); for column in self.flushing.write().iter_mut() { column.clear(); + column.shrink_to_fit(); } Ok(()) },