summaryrefslogtreecommitdiff
path: root/src/HTML5.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/HTML5.php')
-rw-r--r--src/HTML5.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/HTML5.php b/src/HTML5.php
index 94faa1e..c857145 100644
--- a/src/HTML5.php
+++ b/src/HTML5.php
@@ -212,7 +212,10 @@ class HTML5
$trav = new Traverser($dom, $stream, $rules, $options);
$trav->walk();
-
+ /*
+ * release the traverser to avoid cyclic references and allow PHP to free memory without waiting for gc_collect_cycles
+ */
+ $rules->unsetTraverser();
if ($close) {
fclose($stream);
}