WIP Table Destructor (#3707)

There is a circular reference between Worksheet and Table, which can lead to a memory leak. I tried to break this connection in the Worksheet destructor earlier, but this seemed to cause some sort of error with Phpunit 10 on Github, an error that I am unable to duplicate in my local environments. This PR will allow me to explore the problem to see if I can come up with any useful diagnostic data. If I get to a combination that works, I will consider merging it.
This commit is contained in:
oleibman
2023-09-02 20:49:49 -07:00
committed by GitHub
parent 49a04bdf63
commit 7288b4de3d
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -92,6 +92,14 @@ class Table
$this->setName($name);
}
/**
* Code to execute when this table is unset().
*/
public function __destruct()
{
$this->workSheet = null;
}
/**
* Get Table name.
*/
+1 -1
View File
@@ -444,7 +444,7 @@ class Worksheet implements IComparable
$this->disconnectCells();
$this->rowDimensions = [];
//$this->removeTableCollection(); // problem with phpunit10
$this->tableCollection = new ArrayObject();
}
/**