Skip to content

nix flake check memory consumption grows strictly monotonic #13483

@wucke13

Description

@wucke13

Describe the bug

Running nix flake check in my configuration flake balloons up to 30 GB of RAM. I understand there are scenarios where splicing for cross compilation causes abysmal RAM efficiency (and I have some cross compilation NixOS configs in that flake's output). However, I do not understand the following:

The nix flake check seems to be sequential, e.g. one after another it evaluates the outputs of my Flake. However, the memory consumption grows about linearly, strictly monotonic during the entire execution of nix flake check.

Even if splicing causes individual flake output evaluations to consume decent amounts of RAM, why does the RAM consumption not collapse after one such flake output was correctly evaluated?

Steps To Reproduce

I can not share the original flake where this happens, however, the problem (strictly monotonic RAM consumption increase) can be observed on the following repo as well (however only up to 4 GB).

Each of the following has the same effect.

  • nix flake check github:DLR-FT/seL4-nix-utils
  • nix flake check --option allow-import-from-derivation false github:DLR-FT/seL4-nix-utils
  • nix flake check --option allow-import-from-derivation false --no-eval-cache github:DLR-FT/seL4-nix-utils
  • nix flake check --option allow-import-from-derivation false --no-eval-cache --no-build github:DLR-FT/seL4-nix-utils

Expected behavior

Memory consumption stays within the limits of a single flake output evaluation multiplied by the number flake outputs evaluated in parallel.

Metadata

nix-env (Lix, like Nix) 2.93.0
System type: x86_64-linux
Additional system types: aarch64-linux, armv7l-linux, i686-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/wucke13/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/wucke13/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/wucke13/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/wucke13/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/7wv7x01fjp05n40yb263wlrm0hvhzbyn-lix-2.93.0/share

Additional context

This behavior occurs with Nix and with Lix.

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions