drop spec when no longer useful

This commit is contained in:
Robert Habermeier 2016-11-15 19:07:23 +01:00
parent 5127b997eb
commit 8c8bf30de5
3 changed files with 8 additions and 1 deletions

View File

@ -165,6 +165,9 @@ fn execute_import(cmd: ImportBlockchain) -> Result<String, String> {
Arc::new(Miner::with_spec(&spec)), Arc::new(Miner::with_spec(&spec)),
).map_err(|e| format!("Client service error: {:?}", e))); ).map_err(|e| format!("Client service error: {:?}", e)));
// free up the spec in memory.
drop(spec);
panic_handler.forward_from(&service); panic_handler.forward_from(&service);
let client = service.client(); let client = service.client();
@ -312,6 +315,8 @@ fn execute_export(cmd: ExportBlockchain) -> Result<String, String> {
Arc::new(Miner::with_spec(&spec)), Arc::new(Miner::with_spec(&spec)),
).map_err(|e| format!("Client service error: {:?}", e))); ).map_err(|e| format!("Client service error: {:?}", e)));
drop(spec);
panic_handler.forward_from(&service); panic_handler.forward_from(&service);
let client = service.client(); let client = service.client();

View File

@ -235,6 +235,9 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
miner.clone(), miner.clone(),
).map_err(|e| format!("Client service error: {:?}", e))); ).map_err(|e| format!("Client service error: {:?}", e)));
// drop the spec to free up genesis state.
drop(spec);
// forward panics from service // forward panics from service
panic_handler.forward_from(&service); panic_handler.forward_from(&service);

View File

@ -183,7 +183,6 @@ impl SnapshotCommand {
Ok((service, panic_handler)) Ok((service, panic_handler))
} }
/// restore from a snapshot /// restore from a snapshot
pub fn restore(self) -> Result<(), String> { pub fn restore(self) -> Result<(), String> {
let file = self.file_path.clone(); let file = self.file_path.clone();