From 39725a5322e141bba408ad2d9ff0b4bc25f39e92 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Mon, 2 Sep 2013 19:30:19 -0700 Subject: [PATCH] Bug 905221 - sizeof(nsEventQueue::Page) should be a power of two to avoid heap allocation slop. r=bsmedberg --- xpcom/threads/nsEventQueue.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xpcom/threads/nsEventQueue.h b/xpcom/threads/nsEventQueue.h index 7cb08bcad24d..f261a1bb83bf 100644 --- a/xpcom/threads/nsEventQueue.h +++ b/xpcom/threads/nsEventQueue.h @@ -60,7 +60,7 @@ private: return !mHead || (mHead == mTail && mOffsetHead == mOffsetTail); } - enum { EVENTS_PER_PAGE = 250 }; + enum { EVENTS_PER_PAGE = 255 }; // Page objects are linked together to form a simple deque. @@ -69,6 +69,9 @@ private: nsIRunnable *mEvents[EVENTS_PER_PAGE]; }; + static_assert((sizeof(Page) & (sizeof(Page) - 1)) == 0, + "sizeof(Page) should be a power of two to avoid heap slop."); + static Page *NewPage() { return static_cast(calloc(1, sizeof(Page))); }