mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-12 11:06:28 +00:00
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:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -444,7 +444,7 @@ class Worksheet implements IComparable
|
||||
|
||||
$this->disconnectCells();
|
||||
$this->rowDimensions = [];
|
||||
//$this->removeTableCollection(); // problem with phpunit10
|
||||
$this->tableCollection = new ArrayObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user