Closed Bug 41988 Opened 24 years ago Closed 24 years ago

nsViewManager2 leaks an nsDrawingSurfaceGTK on shutdown

Categories

(Core :: Web Painting, defect, P3)

x86
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 48190

People

(Reporter: dbaron, Assigned: rusty.lynch)

Details

(Keywords: memory-leak, Whiteboard: [tind-mlk][need info])

Attachments

(4 files)

DESCRIPTION:  nsViewManager2 leaks an nsDrawingSurfaceGTK because the last 
release of the view manager occurs during XPCOM shutdown.  During XPCOM 
shutdown, nsComponentManager::CreateInstance fails.  This means that |rc| cannot 
be created in |~nsViewManager2|, so |DestroyDrawingSurface| is never called on 
|mDrawingSurface|.

STEPS TO REPRODUCE:
 * use leak logging on "./mozilla -f bloaturls.txt", or look at tinderbox leak 
stats

BUGGY ON:
 * Linux mozilla build of 2000-06-08

ADDITIONAL INFORMATION:
You might be able to just release the drawing surfaces if you can't get a 
rendering context, but I'm not sure how things work on all platforms.
Status: NEW → ASSIGNED
Target Milestone: --- → M21
Whiteboard: [tind-mlk]
taking a look into this
Assignee: kmcclusk → rusty.lynch
Status: ASSIGNED → NEW
Adding previous owner back to cc: list.
Since CreateInstance denies us during shutdown, what if we add another member 
variable for an nsIRenderingContext that is created in the constructor.  Then 
we could use the new member to do the DestroyDrawingSurface's.

I already have it working on my tree.  Is this acceptable?  The additional 
nsIRenderingContext adds a very small about of bloat (96 bytes for the gtk 
version.)

I´ve attached a patch which fixes this problem using an observer upon XPCOM
shutdown. It is enabled to act only when DEBUG is defined, so that it takes away
the noise but doesn´t get in the way on a release version.
Keywords: patch
How is this new patch going to help?  It looks like it still calls
CreateInstance during XPCOM shutdown (in nsViewManager2::xpcom_shutdown).
Sure it does, but this time we are doing it _before_ closing XPCOM, so the
services are still available, and we can request it. See NS_ShutdownXPCOM() ...
well, at least this makes some sense, and works. This is also the explanation I
got for a fix I proposed to bug #38283.
... on this one (is similar to the statics on #43656 and #43644) I have to use
XPCOM (instead of a refcount, which fails) or as Rusty said, create another RC.
Can we agree on a sollution to check it in?
add blizzard and pavlov. you two are the GTK gurus; what say you?
beard: got any preferences/ideas/comments? 

inaky: whichever mechanism we decide to use, this code should *not* be #ifdef
DEBUG.

how many of these objects (nsViewManager2's) get created during the life of the
app? If there is only ever *one*, then let's just keep it around in a member
variable to use on a rainy day. If there are >1, then I'd probably vote for the
XPCOM shutdown hooks (there may be a more elegant way to do this; e.g., at the
module level or something).
In a fast run using the about:blank page and shutting down, refcnt balancer
reports four objects. Going to slashdot shows five.
Keywords: nsbeta3
Cc'ing Valeski. Jud could you make the call about whether this is nsbeta3 + or
-? Thanks.
Whiteboard: [tind-mlk] → [tind-mlk][need info]
I checked in a fix for this bug back on 8/17/2000. If its still leaking a 
drawing surface, it must be for some other reason. I hold a global rendering 
context around just for the purpose of cleaning up the drawing surfaces. When 
the last viewmanager goes away the global rendering context is destroyed as 
well.

*** This bug has been marked as a duplicate of 48190 ***
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
There are no nsDrawingSurfaceGTK leaks shown in the current speedracer bloat 
stats.  If you know of leaks, please file a separate bug with steps to reproduce 
if one is not already filed.
Component: Layout: View Rendering → Layout: Web Painting
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: