From 8c8bf30de57fabb71050b3f8772ba03d51bdc617 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Tue, 15 Nov 2016 19:07:23 +0100 Subject: [PATCH] drop spec when no longer useful --- parity/blockchain.rs | 5 +++++ parity/run.rs | 3 +++ parity/snapshot.rs | 1 - 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/parity/blockchain.rs b/parity/blockchain.rs index 9575b293a..cfcbaed28 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -165,6 +165,9 @@ fn execute_import(cmd: ImportBlockchain) -> Result { Arc::new(Miner::with_spec(&spec)), ).map_err(|e| format!("Client service error: {:?}", e))); + // free up the spec in memory. + drop(spec); + panic_handler.forward_from(&service); let client = service.client(); @@ -312,6 +315,8 @@ fn execute_export(cmd: ExportBlockchain) -> Result { Arc::new(Miner::with_spec(&spec)), ).map_err(|e| format!("Client service error: {:?}", e))); + drop(spec); + panic_handler.forward_from(&service); let client = service.client(); diff --git a/parity/run.rs b/parity/run.rs index 56ff92c25..5d581576c 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -235,6 +235,9 @@ pub fn execute(cmd: RunCmd, logger: Arc) -> Result<(), String> { miner.clone(), ).map_err(|e| format!("Client service error: {:?}", e))); + // drop the spec to free up genesis state. + drop(spec); + // forward panics from service panic_handler.forward_from(&service); diff --git a/parity/snapshot.rs b/parity/snapshot.rs index 872e4ba5e..d8323084d 100644 --- a/parity/snapshot.rs +++ b/parity/snapshot.rs @@ -183,7 +183,6 @@ impl SnapshotCommand { Ok((service, panic_handler)) } - /// restore from a snapshot pub fn restore(self) -> Result<(), String> { let file = self.file_path.clone();