Closed Bug 499446 Opened 15 years ago Closed 15 years ago

Bug 497680 cause reported memory leaks in xpcshell-tests (bayesian-spam-filter and test_bug366491.js)

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b3

People

(Reporter: standard8, Assigned: Bienvenu)

References

Details

(Keywords: memory-leak, regression)

Attachments

(1 file)

The landing of bug 497680 caused reported leaks in all the extensions/bayesian-spam-filter tests and test_bug366491.js (mailnews/base/test/unit).

This is possibly similar to our other rdf resource leak bugs, e.g. bug 498323 or bug 498321), however reporting it here as it is a fresh reported leak.
Flags: wanted-thunderbird3+
I'll look at this.
Assignee: nobody → bienvenu
Status: NEW → ASSIGNED
it looks like a few of the local folder special folders are leaking, e.g., Trash, Unsent Messages...probably a ref-counting problem...
Attached patch proposed fixSplinter Review
fixes ref counting problem in GetAllFolders.

The closer we get to 0 leaks, the easier it is to find leak regressions :-)
Attachment #384265 - Flags: superreview?(bugzilla)
Attachment #384265 - Flags: review?(bugzilla)
Whiteboard: [has patch for review, standard8]
Attachment #384265 - Flags: superreview?(bugzilla)
Attachment #384265 - Flags: superreview+
Attachment #384265 - Flags: review?(bugzilla)
Attachment #384265 - Flags: review+
Comment on attachment 384265 [details] [diff] [review]
proposed fix

>   for (i = 0; i < folderCount; i++)
>-    folderArray->AppendElement(allDescendents->ElementAt(i), PR_FALSE);
>+  {
>+    nsCOMPtr<nsIMsgFolder> folder(do_QueryElementAt(allDescendents, i));
>+    folderArray->AppendElement(folder, PR_FALSE);
>+  }

I think moving the nsCOMPtr outside the loop is meant to be a bit more efficient. Alternately we could just drop the nsCOMPtr and append the result of do_QueryElementAt, as the change to do_QueryElementAt is what is fixing the leak here.

r/sr=Standard8 either way.
do_QueryElementAt by itself doesn't compile - perhaps some sort of casting would have helped, but I just moved the comptr outside the loop. Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [has patch for review, standard8]
Target Milestone: --- → Thunderbird 3.0b3
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: