Closed Bug 231278 Opened 21 years ago Closed 21 years ago

leaks on stop due to PresShell's queue of DOM events not being processed

Categories

(Core :: Layout, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: dbaron, Assigned: dbaron)

References

()

Details

(Keywords: memory-leak, Whiteboard: [patch])

Attachments

(1 file)

If I start loading www.w3.org (from X-Remote with new-tab, actually), and then quickly stop it, I leak a good bit of stuff. I think the root, or one of them, at least, is that the pres shell's queues stored in the variables: // used for list of posted events and attribute changes. To be done // after reflow. nsDOMEventRequest* mFirstDOMEventRequest; nsDOMEventRequest* mLastDOMEventRequest; nsAttributeChangeRequest* mFirstAttributeRequest; nsAttributeChangeRequest* mLastAttributeRequest; nsCallbackEventRequest* mFirstCallbackEventRequest; nsCallbackEventRequest* mLastCallbackEventRequest; are not guaranteed to be processed. (In this case, it's the first one.) These request variables own references to content. They need to be freed in the pres shell's Destroy method.
Attached patch patchSplinter Review
I can't reproduce the leak with this patch.
Status: NEW → ASSIGNED
Priority: -- → P1
Whiteboard: [patch]
Target Milestone: --- → mozilla1.7alpha
Attachment #139293 - Flags: superreview?(roc)
Attachment #139293 - Flags: review?(bz-vacation)
Attachment #139293 - Flags: superreview?(roc) → superreview+
>Index: nsPresShell.cpp >=================================================================== > struct VerifyReflowFlags { >- char* name; >+ const char* name; > PRUint32 bit; > }; > >-static VerifyReflowFlags gFlags[] = { >+static const VerifyReflowFlags gFlags[] = { > { "verify", VERIFY_REFLOW_ON }, Just fyi: I recently tried something similar and Visual C++ complained with an error. Basically, I couldn't get it to compile struct whatever { const int i; }; const whatever foo = { 0 }; Removing the const from i worked, so it could be that you have to undo the constifying of name.
The analogy to |const int| for a char pointer is |char * const|, not |const char*|, so I'm not worried. (Furthermore, I've done this in many other places.)
Yeah sorry, I remember, I was trying const char* const.
Comment on attachment 139293 [details] [diff] [review] patch r=bzbarsky, but do we still need to clear these out in Destroy, just in case?
Attachment #139293 - Flags: review?(bz-vacation) → review+
We shouldn't, since they should only be added to during reflow. But I added an assertion in the pres shell's destructor just in case.
Fix checked in to trunk, 2004-01-20 20:15 -0800.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: