Closed Bug 448980 Opened 11 years ago Closed 11 years ago

In XPCShell tests (createInstance()?) - leaks 437 nsStringBuffer

Categories

(Core :: Layout, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla1.9.1b1

People

(Reporter: sgautherie, Unassigned)

References

Details

(Keywords: memory-leak)

Attachments

(2 files)

[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1a2pre) Gecko/2008080319 Minefield/3.1a2pre] (home, optim default) (W2Ksp4)

1. |make check| from <.../objdir-.../toolkit/mozapps/update/src>
1r.
{{
.../dist/bin/xpcshell.exe -f nsUpdateService.js .../toolkit/mozapps/update/src/testnsUpdateService.js
### XPCOM_MEM_LEAK_LOG defined -- logging leaks to stdout
0.016
0
0
0

== BloatView: ALL (cumulative) LEAK STATISTICS

     |<----------------Class--------------->|<-----Bytes------>|<----------------Objects---------------->|<--------------References-------------->|
                                              Per-Inst   Leaked    Total      Rem      Mean       StdDev     Total      Rem      Mean       StdDev
   0 TOTAL                                          15     3496    11757      437 (  306,85 +/-   412,01)    25561      437 (  182,39 +/-   279,20)
 122 nsStringBuffer                                  8     3496     2285      437 (  736,10 +/-   282,17)     3688      437 (  743,08 +/-   270,17)

nsTraceRefcntImpl::DumpStatistics: 160 entries
}}

Removing |createInstance()| call (and following code) stops the leak.

***

Same leak report after
{{
cd .../toolkit/components/feeds/test;  .../objdir-.../dist/bin/xpcshell.exe shell.js 
}}

***

(Not sure which component to file this in...)
Attached file Tree from Optim build
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1a2pre) Gecko/2008080319 Minefield/3.1a2pre] (home, optim default) (W2Ksp4)

|make-tree.pl| output.
Attached file Tree from Debug build
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1a2pre) Gecko/2008080121 Minefield/3.1a2pre] (home, debug default) (W2Ksp4)

|make-tree.pl| output.
This is the first time I use the |make-tree| tool(s).

Optim and Debug outputs are totally different: I don't know which one to believe :-(
Flags: wanted1.9.1?
Keywords: helpwanted
This is one of the tests added before the xpcshell-simple test harness. Many of those tests leak 437 nsStringBuffer in debug builds but they write it to their individual log files.
(In reply to comment #4)

I'm not sure what you meant;
but the leak is reported even with "logrefcnt" only (= not "debug" specific).
What I mean is that I believe that what you are seeing would be seen by many of the tests written for the xpcshell-simple test harness in both debug and optimized builds if they were written in the same manner as this test. I am close to 100% certain this is the case for debug builds since the log files for many tests leak 437 nsStringBuffer as shown by their log files and I am only slightly less certain that the same leaks will be reported for optimized builds.

So, the leaks could be artifacts of using xpcshell for the test.
(In reply to comment #6)

A search in my Firefox optim/default build finds (at least) 20 + 3 log files with (at least) this leak.
(I don't know why I only noticed 2 of them only in comment 0.)

Are you saying that something in all these tests should be rewritten differently ? (What ? How ?)

If it's an artifact of xpcshell, I hope it can be "fixed",
as I think the goal should be "no" leak.
Component: Application Update → Testing
Product: Toolkit → Core
QA Contact: software.update → testing
From bug 431139 comment 5, I guess SeaMonkey has the same leak(s).
Blocks: 449240
(In reply to comment #7)
>...
> Are you saying that something in all these tests should be rewritten
> differently ? (What ? How ?)
I don't know what or if anything can be done about these leaks in the xpcshell tests since I haven't had the time to debug them. As for finding leaks... I typically use the application and not the tests to find leaks.
testnsUpdateService.js will be going away via bug 450790 and this is really a general XPCShell test leak so changing summary.
Summary: In <testnsUpdateService.js>, |createInstance()| leaks 437 nsStringBuffer → In XPCShell tests (createInstance()?) - leaks 437 nsStringBuffer
Blocks: 453146
Depends on: 450790
Could this just be a dupe of bug 453146?
(In reply to comment #11)

Probably, but be a just little patient ;-)
I'm currently compiling with/without your patch there to verify both bugs...
(In reply to comment #4)
> but they write it to their individual log files.

(In reply to comment #7)
> (I don't know why I only noticed 2 of them only in comment 0.)

Now I understand (better) what you wrote:
only these 2 tests reported to the console;
the others reported to their own log file. (which I learned in the process.)

*****

(In reply to comment #11)
> Could this just be a dupe of bug 453146?

Yes, they are.
Yet, marking it as R.Fixed, for the dependencies (only).
No longer blocks: 453146
Status: NEW → RESOLVED
Closed: 11 years ago
Component: Testing → Layout
Depends on: 453146
Flags: wanted1.9.1?
Keywords: helpwanted
OS: Windows 2000 → All
QA Contact: testing → layout
Hardware: PC → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b1
No longer blocks: 449240
You need to log in before you can comment on or make changes to this bug.