[Nix-dev] Why Nix-0.16 so hungry on ressources (mem + cpu) ?

Lluís Batlle i Rossell viriketo at gmail.com
Sun Oct 30 21:47:17 CET 2011


On Sun, Oct 30, 2011 at 09:34:50PM +0100, Vladimír Čunát wrote:
> Hi.
> 
> On 26 October 2011 23:47, Paul Dufresne <dufresnep at gmail.com> wrote:
> > It seems that it need to evaluate all the nix expressions in the
> > unstable packages.While doing this, top reports that it eats about 72%
> > of my memory (256Mb Physical + 256Mb virtual).
> 
> I'm afraid this is normal behaviour. Performance of nix evaluation
> certainly isn't so good, but we seem to have much stronger machines,
> so we don't mind so much (there are many other problems).
> 
> And yes, the expressions are evaluated every time, but lazily.
> Installing by attribute name instead of package name helps a lot
> there, because all the package names have to be evaluated to select by
> package name (attribute name select directly). Here's a small test,
> measuring physical memory usage (using absolute path for time to
> prevent firing bash builtin):
> 
> "/var/run/current-system/sw/bin/time -f %M nix-env -i hello --dry-run"
> reports using 1.3 GB RAM (!)
> "/var/run/current-system/sw/bin/time -f %M nix-env -iA hello
> --dry-run" reports 56 MB RAM

The amount of memory used depends on the RAM available in the system (on a
fixed percent of it).
There is an env var, GC_INITIAL_HEAP_SIZE, that can make that smaller.

I imagine that the particularities of 'boehm-gc' makes this initial allocation
work as if there was no 'lazy allocation' in linux, therefore reporting that
much ram usage.

Regards,
Lluís.


More information about the nix-dev mailing list