From ab4015b189b51f3afda3baf4fd1c4dc2efd63230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Mon, 6 Mar 2017 19:07:11 +0100 Subject: [PATCH] Shell: fix (part of) the memory leak in validator --- src/node/shell/validator.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/node/shell/validator.ml b/src/node/shell/validator.ml index 7bbb0f50b..63358e0f9 100644 --- a/src/node/shell/validator.ml +++ b/src/node/shell/validator.ml @@ -299,6 +299,9 @@ module Context_db = struct block.operations >>= fun () -> return (Ok block, false) | Some block -> + Lwt_list.iter_p (fun hash -> + Distributed_db.Operation.commit net_db hash) + block.operations >>= fun () -> return (Ok block, true) end | Error err -> @@ -388,9 +391,10 @@ module Context_db = struct min_block block acc else begin Block_hash.Table.replace session.tbl hash { data with state = `Running begin - process data.validator ~get_context ~set_context hash block >>= fun res -> - Block_hash.Table.remove session.tbl hash ; - Lwt.return res + Lwt_main.yield () >>= fun () -> + process data.validator ~get_context ~set_context hash block >>= fun res -> + Block_hash.Table.remove session.tbl hash ; + Lwt.return res end } ; acc end)