nsEventQueue slop because NewPage() allocates non-power-of-two sized event queue objects

RESOLVED FIXED in Firefox 26

Status

()

Core
XPCOM
--
minor
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

unspecified
mozilla26
Points:
---

Firefox Tracking Flags

(firefox25 wontfix, firefox26 fixed)

Details

(Whiteboard: [MemShrink:P3][clownshoes])

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
nsEventQueue uses a linked list of Page objects to pass pointers to nsThreads. A Page is a struct containing 251 pointers. Depending on sizeof(void*), a Page uses only 1004 or 2008 bytes of its heap block's actual 1024 or 2048 bytes before allocating the next Page.

Also, one might ask whether 250 is a reasonable value for EVENTS_PER_PAGE. In my testing, most nsEventQueues have a high-water mark less than ~50 events.

https://hg.mozilla.org/mozilla-central/file/4930fdea3efa/xpcom/threads/nsEventQueue.h#l63
Whiteboard: [MemShrink]
If you change it to 255, a static assertion that sizeof(Page) is a power of two would be great!
Whiteboard: [MemShrink] → [MemShrink:P3]
(Assignee)

Comment 2

4 years ago
Created attachment 798703 [details] [diff] [review]
EVENTS_PER_PAGE.patch

Increase nsEventQueue::EVENTS_PER_PAGE from 250 to 255 so sizeof(nsEventQueue::Page) will be a power of two to avoid heap allocation slop.
Assignee: nobody → cpeterson
Status: NEW → ASSIGNED
Attachment #798703 - Flags: review?(benjamin)
(Assignee)

Comment 3

4 years ago
bsmedberg: btw, here are your original comments on EVENTS_PER_PAGE from 2006:

https://bugzilla.mozilla.org/show_bug.cgi?id=326273#c54

Updated

4 years ago
Attachment #798703 - Flags: review?(benjamin) → review+
Whiteboard: [MemShrink:P3] → [MemShrink:P3][clownshoes]
(Assignee)

Comment 4

4 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/f43fed6391f7
status-firefox25: --- → wontfix
status-firefox26: --- → fixed

Comment 5

4 years ago
https://hg.mozilla.org/mozilla-central/rev/f43fed6391f7
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.