From ace38942ba8815388353ddeb5e4f18a5f44bef61 Mon Sep 17 00:00:00 2001 From: Florin Pop Date: Tue, 2 Jul 2024 08:59:47 +0200 Subject: [PATCH] Fix memory leak in waterworld_v4 by clearing old handlers before adding new ones (#1218) --- pettingzoo/sisl/waterworld/waterworld_base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pettingzoo/sisl/waterworld/waterworld_base.py b/pettingzoo/sisl/waterworld/waterworld_base.py index b6705b76b..7c82da4e4 100644 --- a/pettingzoo/sisl/waterworld/waterworld_base.py +++ b/pettingzoo/sisl/waterworld/waterworld_base.py @@ -313,6 +313,8 @@ def draw(self): def add_handlers(self): # Collision handlers for pursuers v.s. evaders & poisons + self.handlers = [] + for pursuer in self.pursuers: for obj in self.evaders: self.handlers.append(