Closed Bug 905221 Opened 11 years ago Closed 11 years ago

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

Categories

(Core :: XPCOM, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla26
Tracking Status
firefox25 --- wontfix
firefox26 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

Details

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

Attachments

(1 file)

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]
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)
bsmedberg: btw, here are your original comments on EVENTS_PER_PAGE from 2006:

https://bugzilla.mozilla.org/show_bug.cgi?id=326273#c54
Attachment #798703 - Flags: review?(benjamin) → review+
Whiteboard: [MemShrink:P3] → [MemShrink:P3][clownshoes]
https://hg.mozilla.org/mozilla-central/rev/f43fed6391f7
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: