Closed Bug 1490537 Opened 6 years ago Closed 5 years ago

nsTArray leak with debug mochitests and WebRender

Categories

(Core :: Graphics: WebRender, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox-esr60 --- unaffected
firefox64 --- disabled
firefox65 --- fixed

People

(Reporter: mattwoodrow, Assigned: lsalzman)

References

Details

(Keywords: memory-leak, perf)

Attachments

(1 file)

Enabling debug mochitests for Windows WR reveals a leak of an nsTArray.

Stack for the leaked object:

 5:41.34 INFO allocation stack:
 5:41.34 INFO #00: nsTArray_base<nsTArrayInfallibleAllocator,nsTArray_CopyWithMemutils>::nsTArray_base (c:\Users\mattwoodrow\src\mozilla-central\obj-ff-debug64\dist\include\nsTArray-inl.h:16)
 5:41.34 INFO #01: nsTArray_Impl<unsigned char,nsTArrayInfallibleAllocator>::nsTArray_Impl (c:\Users\mattwoodrow\src\mozilla-central\obj-ff-debug64\dist\include\nsTArray.h:936)
 5:41.34 INFO #02: nsTArray<unsigned char>::nsTArray (c:\Users\mattwoodrow\src\mozilla-central\obj-ff-debug64\dist\include\nsTArray.h:2604)
 5:41.34 INFO #03: mozilla::gfx::DWriteFontFileStream::DWriteFontFileStream (c:\Users\mattwoodrow\src\mozilla-central\gfx\2d\NativeFontResourceDWrite.cpp:175)
 5:41.34 INFO #04: mozilla::gfx::NativeFontResourceDWrite::Create (c:\Users\mattwoodrow\src\mozilla-central\gfx\2d\NativeFontResourceDWrite.cpp:245)
 5:41.34 INFO #05: mozilla::gfx::Factory::CreateNativeFontResource (c:\Users\mattwoodrow\src\mozilla-central\gfx\2d\Factory.cpp:645)
 5:41.34 INFO #06: mozilla::wr::GetUnscaledFont (c:\Users\mattwoodrow\src\mozilla-central\gfx\webrender_bindings\Moz2DImageRenderer.cpp:269)
 5:41.34 INFO #07: mozilla::wr::GetScaledFont (c:\Users\mattwoodrow\src\mozilla-central\gfx\webrender_bindings\Moz2DImageRenderer.cpp:302)
 5:41.34 INFO #08: mozilla::wr::Moz2DRenderCallback (c:\Users\mattwoodrow\src\mozilla-central\gfx\webrender_bindings\Moz2DImageRenderer.cpp:429)
 5:41.34 INFO #09: wr_moz2d_render_cb (c:\Users\mattwoodrow\src\mozilla-central\gfx\webrender_bindings\Moz2DImageRenderer.cpp:473)
 5:41.34 INFO #10: webrender_bindings::moz2d_renderer::{{impl}}::rasterize::{{closure}}::{{closure}} (c:\Users\mattwoodrow\src\mozilla-central\gfx\webrender_bindings\src\moz2d_renderer.rs:380)
Any ideas Lee?
Flags: needinfo?(lsalzman)
Priority: -- → P2
Lee -- is this one that you can take a look at?
Assignee: nobody → lsalzman
Any progress on this Lee?
The GPU process bypasses gfxPlatform init and shutdown, which means we also bypass init and shutdown of SkGraphics. This has a few bad consequences such as not initializing Skia's SIMD optimizations and not purging the Skia font cache during shutdown.

This patch resolves that.
Flags: needinfo?(lsalzman)
Attachment #9028803 - Flags: review?(matt.woodrow)
Status: NEW → ASSIGNED
Keywords: memory-leak, perf
Comment on attachment 9028803 [details] [diff] [review]
init and shutdown Skia in the GPU process

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

::: gfx/ipc/GPUParent.cpp
@@ +222,5 @@
>    for (const LayerTreeIdMapping& map : aMappings) {
>      LayerTreeOwnerTracker::Get()->Map(map.layersId(), map.ownerId());
>    }
>  
> +  SkGraphics::Init();

Maybe worth a comment explaining that we intentionally don't initialize gfxPlatform, so we have to manually initialize the bits that we need.

In the long term it might be nice to have a properly defined subset of gfxPlatform that the GPU process needs, rather than ad-hoc lines here.
Attachment #9028803 - Flags: review?(matt.woodrow) → review+
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e0639d2ca407
init and shutdown Skia in the GPU process. r=mattwoodrow
https://hg.mozilla.org/mozilla-central/rev/e0639d2ca407
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
This generated a performance improvement:

== Change summary for alert #17955 (as of Thu, 29 Nov 2018 21:10:15 GMT) ==

Improvements:

  9%  tsvgx windows10-64-qr opt e10s stylo           241.32 -> 220.48
  6%  tsvg_static windows10-64-qr opt e10s stylo     49.16 -> 46.00

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=17955
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: