From 4947a42a403159e4d2b6e1e0db5a250f5a8efca4 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 11 Aug 2011 18:53:29 -0700 Subject: [PATCH] Bug 678422 - Avoid wasting half of nsPresArena's allocated memory due to clownshoes. r=roc. --- layout/base/nsPresArena.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layout/base/nsPresArena.cpp b/layout/base/nsPresArena.cpp index f5f887f0ed50..7494dad46083 100644 --- a/layout/base/nsPresArena.cpp +++ b/layout/base/nsPresArena.cpp @@ -83,7 +83,11 @@ #endif // Size to use for PLArena block allocations. -static const size_t ARENA_PAGE_SIZE = 4096; +// XXX: This should be 8192; the subtracted elements are a hack that's +// required to ensure the allocation requests are power-of-two-sized and thus +// avoid lots of wasted memory caused by the heap allocator rounding up request +// sizes. Bug 676457 will fix it properly. +static const size_t ARENA_PAGE_SIZE = 8192 - sizeof(PLArena) - PL_ARENA_CONST_ALIGN_MASK; // Freed memory is filled with a poison value, which we arrange to // form a pointer either to an always-unmapped region of the address