It is stored in a StaticRefPtr that is never cleared, so we leak. The obvious thing to do is ClearOnShutdown the pointer but that it appears we create HwcComposer2d off the main thread so that is not an option. Do we need the StaticRefPtr? Can we rely on something else holding the strong reference?
HwcComposer2d seems to be used from LayerManagerComposite and GLContextEGL. GLContextEGL holds strong pointer but LayerManagerComposite just hold the strong pointer only during its usage. http://dxr.mozilla.org/mozilla-central/source/gfx/gl/GLContextProviderEGL.cpp#236 http://dxr.mozilla.org/mozilla-central/source/gfx/layers/composite/LayerManagerComposite.cpp#425
From comment 1, How to access HwComposer2d seems inconsistent between LayerManagerComposite and GLContextEGL.