mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 905221 - sizeof(nsEventQueue::Page) should be a power of two to avoid heap allocation slop. r=bsmedberg
This commit is contained in:
parent
114ff5ef9e
commit
39725a5322
@ -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)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user