From a05c99c60f4af3e48deb478db225029cf7816e5f Mon Sep 17 00:00:00 2001
From: Chris <christianilhoefer@gmail.com>
Date: Mon, 24 Mar 2025 13:24:41 +0100
Subject: [PATCH] fixed file memory leak when viewing graphs

---
 code/main.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/code/main.py b/code/main.py
index 1288280..39fba55 100644
--- a/code/main.py
+++ b/code/main.py
@@ -394,6 +394,7 @@ class GraphViewer:
     def display_graph(self, graph_file):
         if self.canvas:
             self.canvas.get_tk_widget().destroy()
+            plt.close(self.fig)  # Close the previous figure to release memory
 
         img = plt.imread(os.path.join("resulting_figures", graph_file))
         self.fig, self.ax = plt.subplots()
-- 
GitLab