fix: optimize memory usage
This commit is contained in:
parent
6ee6a26aee
commit
7c86f82527
@ -9,6 +9,7 @@ namespace QL\Dom;
|
||||
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
use phpQuery;
|
||||
use phpQueryObject;
|
||||
use QL\QueryList;
|
||||
use Closure;
|
||||
|
||||
@ -49,6 +50,7 @@ class Query
|
||||
public function setHtml($html, $charset = null)
|
||||
{
|
||||
$this->html = value($html);
|
||||
$this->destroyDocument();
|
||||
$this->document = phpQuery::newDocumentHTML($this->html,$charset);
|
||||
return $this->ql;
|
||||
}
|
||||
@ -274,8 +276,9 @@ class Query
|
||||
|
||||
protected function destroyDocument()
|
||||
{
|
||||
if($this->document instanceof phpQueryObject) {
|
||||
$this->document->unloadDocument();
|
||||
unset($this->document);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
|
Loading…
x
Reference in New Issue
Block a user