Skip to content

Large files within source tree causes build to run out of memory #358

@gulrotkake

Description

@gulrotkake

If the size of a file or a sufficient number of files in a nix-build exceeds the amount of memory available, Nix runs out of memory and gives up. For example, given this simple build:

{ stdenv, pkgs, ... } :

stdenv.mkDerivation rec {
  name = "huge";
  src = ./.;
  buildInputs = [ ];
  buildPhase =
    ''
        md5sum huge.bin > md5.result
    '';

  installPhase =
   ''
     mkdir $out
     mv md5.result $out
  '';
}

where huge.bin is a very huge file, nix will first warn:

warning: dumping very large path (> 256 MiB); this may run out of memory

before eventually running out of memory.

The above was tested with

nix-build (Nix) 1.8pre3834_9b146a5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions