Skip to content

runtime: a single allocation near 1GB fails on 64-bit unix regardless of free memory #5760

Description

@0pcom

allocateHeap caps the heap at 1GB on every target. With -gc=conservative or -gc=precise, a single allocation approaching 1GB fails with out of memory no matter how much system RAM is free. The case that hit this was a 1GiB scrypt key derivation buffer (N=1<<20, r=8) on a machine with 16GB free.

On 64-bit targets the reservation can be much larger. An mmap only reserves address space, and pages cost physical memory when first touched. The growHeap comment already points this way. 32-bit targets would keep the 1GB cap.

PR #5644 reserves 16GB of address space on 64-bit unix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions