From bf87f4ed729a22763ae015f70329fc29976f1526 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 22 Oct 2016 17:10:49 +0200 Subject: [PATCH] Fixed the most annoying GC issue ever --- .../html/input/node/HtmlInputNodeWoltlabMetacode.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php index f19b72fdc9..bdcda157cf 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php @@ -127,6 +127,13 @@ class HtmlInputNodeWoltlabMetacode extends AbstractHtmlInputNode { } DOMUtil::replaceElement($element, $newElement); + + // We're explicitly throwing away the doc fragment, as any remaining + // nodes will otherwise stick around for a while. They continue to exist + // until `createElement` or `createDocumentFragment` are called which + // cause an internal GC process that throws away the children, making + // the end of their lifetime unpredictable. Thanks PHP. + unset($fragment); } else { // attributes are invalid, remove element from DOM -- 2.20.1