-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make local evaluation less memory intensive #103
Comments
I see evaluations easily go over 6GiB memory usage, which way beyond reasonable. I think the issue is that all the evaluated code is kept in RAM at once, although we never need more than what is required to evaluate one package at a time. If we could evaluate the packages sequentially in a way that discards the result as soon as possible that would help a lot. I don't know but I suspect that fixing this will require improving stuff within Nix itself. |
Aaand I just saw 7-8 GB of memory usage. 👏 |
The issue is there is no real way of evaluating sequentially. For each package you would need to evaluate its dependencies at least. So you would trait a way longer CPU time for memory. |
An efficient evaluator might be written in c++ itself. It could cache some evaluated store paths in memory while throwing away all the leaked nix state |
Last time I tried to reduce nix memory usage. I understand that all expression are keep in memory because you don't know in advance if they will be required later: {
foo = callPackage ./pkgs/foo {};
bar = callPackage ./pkgs/bar {};
baz = callPackage ./pkgs/baz {};
} bar might need foo. Once bar is evaluated we can't throw foo because it might be needed for evaluating baz. If we throw it we will need to recompute baz. So it will be more CPU hungry. Here is some hint if you want to improve nix memory usage NixOS/nix#7811 (comment) |
Just observed 14 GB of memory usage. o_0 |
I'm actually getting an entire system crash when running |
related: I believe the switch to nix-eval-jobs will also aid in reducing the memory requirements, trading heap memory for duplicate computations. |
+1 to this. On Linux 6.11+ evaluation entirely fails on my system. I wrote up a little bit more about it over on nix-index: nix-community/nix-index#64 (comment) On a side note, I've been actually struggling a lot in the testing of a large nixpkgs PR entirely due to this exact problem. So far, every single build (not eval yes, but closely related to Nix) failure I've run into was a result of system resource exhaustion, and it's become quite bothersome. |
I've been hitting 99% RAM Usage too, when trying to run nixpkgs-review, and after that my terminal just crashes with 16GB of RAM. |
I have hit around 15 GB of RAM, which is twice my laptop's capacity. Enabling zram and disabling my swap partition caused the OOM killer to crash my system last night (or earlier today, i forgot). |
Currently nix needs around 3.6GB heap space when evaluation nixpkgs.
This is too much.
The text was updated successfully, but these errors were encountered: