Bug 905221 - sizeof(nsEventQueue::Page) should be a power of two to avoid heap allocation slop. r=bsmedberg

This commit is contained in:
Chris Peterson 2013-09-02 19:30:19 -07:00
parent 114ff5ef9e
commit 39725a5322

View File

@ -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<Page *>(calloc(1, sizeof(Page)));
}