Closed
Bug 397386
Opened 17 years ago
Closed 17 years ago
Large leak on grono.net front page
Categories
(Core :: XSLT, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: sayrer, Assigned: sayrer)
References
()
Details
(Keywords: memory-leak)
Attachments
(4 files, 1 obsolete file)
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
sicking
:
review+
sicking
:
superreview+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
peterv
:
review+
peterv
:
superreview+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
Updated•17 years ago
|
OS: Mac OS X → All
fyi, this was found as part of the testing described at http://www.wykiwyk.com/mozilla/leakTesting/testlog_20070921_summary.html.
Assignee | ||
Comment 2•17 years ago
|
||
This is a somewhat cleaned up version of http://s1.grono.net/js/login.8.js.
It looks like this script leaks by declaring event listeners that close over XPath results, but it's hard to tell because it looks like the script calls XHR recursively and the site happens to be down for maintenance at the moment. If the Polish-English translation I got is correct, it should be back in an hour or so.
Assignee | ||
Comment 3•17 years ago
|
||
This fixes the leak for me, but maybe there are other XPath classes that should participate.
Comment 4•17 years ago
|
||
Comment on attachment 282210 [details] [diff] [review]
have nsXPathResult participate in cycle collection
>Index: content/xslt/src/xpath/nsXPathResult.cpp
>===================================================================
>+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXPathResult)
>+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocument)
This should call RemoveMutationObserver if mDocument is non-null.
I think it should also call releaseNodeSet.
>+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
>+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXPathResult)
>+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocument)
>+ txNodeSet *nodeSet = static_cast<txNodeSet*>(tmp->mResult.get());
>+ if (nodeSet && nodeSet->getResultType() == txAExprResult::NODESET && nodeSet->size() > 0) {
I'd prefer if you checked for getResultType() == txAExprResult::NODESET before casting to txNodeSet. And put the code in a block to avoid any conflicts with variables declared in the BEGIN macro.
{
txAResultResult *result = tmp->mResult.get();
if (result && result->getResultType() == txAExprResult::NODESET)
txNodeSet *nodeSet = static_cast<txNodeSet*>(tmp->mResult.get());
...
}
Looks good otherwise.
>+ nsCOMPtr<nsIDOMNode> node;
>+ PRInt32 count = nodeSet->size();
>+ PRInt32 i;
>+ for (i = 0; i < count; ++i) {
>+ txXPathNativeNode::getNode(nodeSet->get(i), getter_AddRefs(node));
>+ cb.NoteXPCOMChild(node);
Hmm, maybe we should add an API to get the refcounted node without addrefing.
Attachment #282210 -
Flags: review?(peterv) → review-
Comment 5•17 years ago
|
||
Add more XPath classes to cycle collection. I think this catches the remaining ones.
Attachment #282266 -
Flags: superreview?(jonas)
Attachment #282266 -
Flags: review?(jonas)
Comment 6•17 years ago
|
||
I thought that refcounting inside Traverse was generally a no-no. Am I mistaken?
Attachment #282266 -
Flags: superreview?(jonas)
Attachment #282266 -
Flags: superreview+
Attachment #282266 -
Flags: review?(jonas)
Attachment #282266 -
Flags: review+
Comment 7•17 years ago
|
||
I think it should mostly be fine (if not done on the object that's being traced).
Comment 8•17 years ago
|
||
Comment on attachment 282266 [details] [diff] [review]
nsXPathExpression/nsXPathNSResolver v1
Fix leaks by making objects participate in cycle collection.
Attachment #282266 -
Flags: approval1.9?
Assignee | ||
Comment 9•17 years ago
|
||
> I think it should also call releaseNodeSet.
This causes a crash or abort.
Assignee | ||
Comment 10•17 years ago
|
||
Attachment #282210 -
Attachment is obsolete: true
Attachment #282287 -
Flags: review?(peterv)
Comment 11•17 years ago
|
||
Comment on attachment 282287 [details] [diff] [review]
address peter's comments
Not calling releaseNodeSet is fine, I'll try to figure out why it crashes.
Attachment #282287 -
Flags: superreview+
Attachment #282287 -
Flags: review?(peterv)
Attachment #282287 -
Flags: review+
Attachment #282287 -
Flags: approval1.9?
Updated•17 years ago
|
Attachment #282287 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Comment 12•17 years ago
|
||
This also improved our collection at shutdown. Previously, we were holding onto 4 DOM windows until the JS-implemented XPCOM services were released. The microsummary service uses XPath, so perhaps there was a cycle there, too.
Updated•17 years ago
|
Attachment #282266 -
Flags: approval1.9? → approval1.9+
Updated•17 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Updated•17 years ago
|
Component: General → XSLT
Updated•17 years ago
|
Flags: in-testsuite?
You need to log in
before you can comment on or make changes to this bug.
Description
•