How to deal with phpexcel read excel memory release

when php uses phpexcel to read excel, if the excel itself has more rows and rows, it is easy to cause
Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)
insufficient memory error,

so I wrote a script that uses phpexcel filter to achieve block-level reading, but each time the read is finished, the memory occupied will not be released, resulting in an error that Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) does not have enough memory after multiple reads.

using unset,=null has no obvious effect. After looking up the information,
adds Desroty methods to the PHPExcel_Worksheet and phpexcel classes, and explicit calls do not use

.
public function Destroy() {
    foreach($this->_cellCollection as $index => $dummy) {
        $this->_cellCollection[$index] = null;
    }
    $this->_cellCollection = null;
}

public function Destroy() {
    foreach($this->_workSheetCollection as $index => $dummy) {
        $this->_workSheetCollection[$index]->Destroy();
        $this->_workSheetCollection[$index] = null;
    }
    $this->_workSheetCollection = null;
}

which boss has a solution?

Mar.04,2021

has found the answer to the problem. Every time you finish load the excel file and read it, call the disconnectWorksheets () method provided by phpexcel itself with the phpexcel object generated by load, which assigns a null value to the property of phpexcel and frees up memory resources

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eae104-21ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eae104-21ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?