зеркало из https://github.com/mozilla/gecko-dev.git
Bug 905221 - sizeof(nsEventQueue::Page) should be a power of two to avoid heap allocation slop. r=bsmedberg
This commit is contained in:
Родитель
114ff5ef9e
Коммит
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)));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче