From dab858e6c10b24c783ab517308d13b7c9a721722 Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Wed, 16 Aug 2023 20:49:52 -0700 Subject: [PATCH] Memory Leak Worksheet points to Table, Table points back to Worksheet. Circular reference prevents garbage collection. Remove Table collection in Worksheet at destruct time to avoid this problem. --- src/PhpSpreadsheet/Worksheet/Worksheet.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index 9c836c63f3..731bb0e3c2 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -444,6 +444,7 @@ public function __destruct() $this->disconnectCells(); $this->rowDimensions = []; + $this->removeTableCollection(); } /**