I really needed it, my laptop with 8 GB of memory canโt handle nix-env
on nixpkgs-unstable anymore
I use this in my build wrapper script which obviously only addresses the nix part, but is helpful nonetheless:
MEM=$(free --giga | grep Mem | gawk '{print $2}')
if [ "$MEM" -lt 12 ]; then
echo "Detected memory: ${MEM}GB. Lowering GC heap size"
export GC_INITIAL_HEAP_SIZE=1m
fi
Thank you! This seems useful, the default garbage collector size is 384M per Common Environment Variables
I understand your command saves up to 383 MB of memory for a nix process? Seems useful for my systems with 1 or 2 GB!
I understand your command saves up to 383 MB of memory for a nix process?
I donโt know enough about the specific garbage collector or how the various nix commands do allocations to give you anything tangible in terms of quantifiable memory savings.
My only data point - on an 8GB laptop, it would go into swap hell when running other things and doing nixos-rebuild
without this. With this, the laptop would remain usable.