Subject: | Massive memory leak and other bugfixes (patch) |
Through the magic of Devel::Cycle, I have identified and fixed a nigh-all-encompassing memory leak in the
latest version of XML::DOM::Lite. The current code fails to address the fact that, when a weak reference is
copied, the copy becomes a strong reference (see the Scalar::Util documentation); this, coupled with a
couple other mistakes with the use of weak references, prevents any & all non-trivial XML Node objects
from being garbaged-collected, which ultimately precludes any programs making use of XML::DOM::Lite
from being used to parse numerous XML documents in a single run. (I have also removed the weakening of
the 'documentElement' field of Node objects, as I was unable to determine a reason for it to be weak, and
removing the weakening does not cause any circular references that I could detect.)
In addition, I have also added "use warnings; use strict;" to every module and edited them (mostly by adding
"my"s) so that they will compile without errors. Part of these edits involved moving a large block of variable
declarations to the start of the XML::DOM::Lite::XPath package, which explains almost all of the edits to
XPath.pm.
I have also fixed the implementations of the Node->nextSibling method (the diff should be self-
explanatory and facepalm-inducing), the Node->cloneNode method (A hash reference declared as '$copy'
cannot be accessed as '@copy{...}'), and the Parser->parseFile method (Two-argument 'open' went out with
lice-infested powdered wigs).
Thank you, and I hope this patch or one of greater reparation is applied soon.
Subject: | patch04.diff |
Message body is not shown because it is too large.