Last Comment Bug 692122 - nsToolkit::StartAllowingD3D9 leaks the nsToolkit object
: nsToolkit::StartAllowingD3D9 leaks the nsToolkit object
Status: RESOLVED FIXED
: mlk
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: x86 Windows 7
: -- normal (vote)
: mozilla10
Assigned To: :Ehsan Akhgari
:
Mentors:
Depends on:
Blocks: 595277 669953
  Show dependency treegraph
 
Reported: 2011-10-05 08:42 PDT by :Ehsan Akhgari
Modified: 2011-10-06 08:46 PDT (History)
8 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (v1) (1.13 KB, patch)
2011-10-05 08:43 PDT, :Ehsan Akhgari
roc: review+
Details | Diff | Splinter Review

Description :Ehsan Akhgari 2011-10-05 08:42:09 PDT
The leak is pretty obvious, NS_GetCurrentToolkit AddRef's, nothing Release's.  Pretty classic.

Here's how we found out about this.  This leak turned the WinXP debug reftest permaorange when we enabled optimizations for debug builds.  It turns out that nsToolkit::StartAllowingD3D9 is only called if we request a persistent layer manager before the 5 second timer for allowing D3D9 fires.  One of the things which requires persistent layer managers are canvas elements, which are used by the reftest framework.  So, if the reftest framework manages to run its first test before 5 seconds has passed since the startup, we leak the nsToolkit object.  Turning on optimizations on debug builds just made Firefox faster by enough margin to trigger this leak.
Comment 1 :Ehsan Akhgari 2011-10-05 08:43:32 PDT
Created attachment 564865 [details] [diff] [review]
Patch (v1)
Comment 2 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-10-05 14:21:54 PDT
Comment on attachment 564865 [details] [diff] [review]
Patch (v1)

Review of attachment 564865 [details] [diff] [review]:
-----------------------------------------------------------------

Add MOZ_COUNT_CTOR/DTOR to the nsToolkit implementations?
Comment 3 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-10-05 14:22:24 PDT
Comment on attachment 564865 [details] [diff] [review]
Patch (v1)

Review of attachment 564865 [details] [diff] [review]:
-----------------------------------------------------------------

Add MOZ_COUNT_CTOR/DTOR to the nsToolkit implementations?
Comment 4 Ed Morley [:emorley] 2011-10-06 08:46:58 PDT
https://hg.mozilla.org/mozilla-central/rev/fd00836252be

Note You need to log in before you can comment on or make changes to this bug.