Skip to content

Commit

Permalink
discardable_memory: Use smaller chunks on Windows 32 bit.
Browse files Browse the repository at this point in the history
Large chunks are suspected to be the cause for the linked bug (address space
fragmentation). Speculatively use a smaller chunk size to confirm the theory.

Only use a smaller size on Windows 32, as this increases the number of file
descriptors on all platforms, and the underlying issue (address space
fragmentation) is almost impossible on 64 bit architectures, and very unlikely
on Android.

Bug: 983348
Change-Id: Ic3ecc0a37f712be3fa6d45dfb01326b651f3f470
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1915379
Reviewed-by: Peng Huang <penghuang@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715159}
  • Loading branch information
Benoît Lizé authored and Commit Bot committed Nov 14, 2019
1 parent cf755ff commit 8aa81a3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "components/crash/core/common/crash_key.h"

namespace discardable_memory {
namespace {

// Default allocation size.
#if defined(OS_WIN) && defined(ARCH_CPU_32_BITS)
// On Windows 32 bit, use a smaller chunk, as address space fragmentation may
// make a 4MiB allocation impossible to fulfill in the browser process.
// See crbug.com/983348 for details.
const size_t kAllocationSize = 1 * 1024 * 1024;
#else
const size_t kAllocationSize = 4 * 1024 * 1024;
#endif

// Global atomic to generate unique discardable shared memory IDs.
base::AtomicSequenceNumber g_next_discardable_shared_memory_id;
Expand Down

0 comments on commit 8aa81a3

Please sign in to comment.