From 9e18be25fb6ebd7ad938427a6c6b1fa618513bae Mon Sep 17 00:00:00 2001 From: Ishaan Desai Date: Fri, 20 Dec 2024 15:50:33 +0100 Subject: [PATCH] Add tracemalloc.start() and tracemalloc.reset_peak() calls --- micro_manager/micro_manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/micro_manager/micro_manager.py b/micro_manager/micro_manager.py index 9d6efc5..1de1d4c 100644 --- a/micro_manager/micro_manager.py +++ b/micro_manager/micro_manager.py @@ -649,7 +649,7 @@ def _solve_micro_simulations(self, micro_sims_input: list, dt: float) -> tuple: """ micro_sims_output: list[dict] = [None] * self._local_number_of_sims - tracemalloc.reset_peak() + tracemalloc.start() for count, sim in enumerate(self._micro_sims): # If micro simulation has not crashed in a previous iteration, attempt to solve it @@ -710,6 +710,8 @@ def _solve_micro_simulations(self, micro_sims_input: list, dt: float) -> tuple: micro_sims_input, micro_sims_output, unset_sim ) + tracemalloc.reset_peak() + return micro_sims_output, 0.0 def _solve_micro_simulations_with_adaptivity( @@ -755,6 +757,8 @@ def _solve_micro_simulations_with_adaptivity( micro_sims_output = [None] * self._local_number_of_sims + tracemalloc.reset_peak() + # Solve all active micro simulations for active_id in active_sim_ids: # If micro simulation has not crashed in a previous iteration, attempt to solve it