Skip to content
Snippets Groups Projects
Commit 730781b4 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

rts/posix: Use less aggressive backoff schedule for heap reservation sizing

When we allocate the heap on POSIX platforms we generally just ask for a
1TB chunk of address space and call it a day. However, if the user has
set a ulimit then this request will fail. In this case we would
previously try successively smaller allocation requests, reducing the
request size by a factor of two each time.

However, this means that GHC will significantly allocate a significantly
smaller heap than the available physical memory size in some
circumstances.  Imagine, for instance, a machine with 512 GB of physical
memory but a ulimit of 511 GB: we would be limited to a 256 GB heap.

We now use a less aggressive back-off policy, reducing by one-eighth the
last allocation size each try.

Thanks to luispedro for the suggested approach.

Test Plan: Validate

Reviewers: simonmar, erikd

Subscribers: rwbarton, thomie

GHC Trac Issues: #14492

Differential Revision: https://phabricator.haskell.org/D4215
parent 50301093
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment