Commit 11be120f authored by Paul Bone's avatar Paul Bone
Browse files

Bug 1800010 - Make PHC more aggressive r=glandium

Improve the chance that we catch memory errors with PHC by:

 * Increasing the number of PHC slots (increased from 64 to 4096 in most
   cases).
 * Lower the delay for the first PHC allocation, with more slots we can
   afford to trap allocations from earlier in Firefox's startup.

These improve the chance PHC has of catching an error by 64x, at the cost of
additional 1MB of allocation metadata (on 4KB page size systems).  It
shouldn't impact performance more than having PHC on at all.

This patch was originally developed by Randell Jesup.

Differential Revision: https://phabricator.services.mozilla.com/D161934
parent f2944293
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ static const size_t kPageSize =
//
// These page kinds are interleaved; each allocation page has a guard page on
// either side.
static const size_t kNumAllocPages = 64;
static const size_t kNumAllocPages = kPageSize == 4096 ? 4096 : 1024;
static const size_t kNumAllPages = kNumAllocPages * 2 + 1;

// The total size of the allocation pages and guard pages.
@@ -327,7 +327,7 @@ static const Time kMaxTime = ~(Time(0));
// The average delay before doing any page allocations at the start of a
// process. Note that roughly 1 million allocations occur in the main process
// while starting the browser. The delay range is 1..kAvgFirstAllocDelay*2.
static const Delay kAvgFirstAllocDelay = 512 * 1024;
static const Delay kAvgFirstAllocDelay = 64 * 1024;

// The average delay until the next attempted page allocation, once we get past
// the first delay. The delay range is 1..kAvgAllocDelay*2.