(This is the continuation of a thread about the memory requirements of job evaluation on Hydra.)
Here’s a run in conditions similar to those of Hydra: --8<---------------cut here---------------start------------->8--- $ \time -v guile -l build-aux/hydra/gnu-system.scm -c '(use-modules (guix)) (with-store store (hydra-jobs store (list)))' prepending "build-aux/hydra/../.." to the load path ;;; note: source file build-aux/hydra/../../guix/config.scm ;;; newer than compiled /home/ludo/soft/share/guile/site/2.0/guix/config.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling build-aux/hydra/../../guix/config.scm ;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/guix/config.scm.go ;;; note: source file build-aux/hydra/../../guix/store.scm ;;; newer than compiled /home/ludo/soft/share/guile/site/2.0/guix/store.go ;;; compiling build-aux/hydra/../../guix/store.scm ;;; note: source file build-aux/hydra/../../guix/utils.scm ;;; newer than compiled /home/ludo/soft/share/guile/site/2.0/guix/utils.go ;;; compiling build-aux/hydra/../../guix/utils.scm [...] ;;; compiling build-aux/hydra/../../gnu/packages/wdiff.scm ;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/gnu/packages/wdiff.scm.go ;;; compiling build-aux/hydra/../../gnu/packages/gps.scm ;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/gnu/packages/gps.scm.go Command being timed: "guile -l build-aux/hydra/gnu-system.scm -c (use-modules (guix)) (with-store store (hydra-jobs store (list)))" User time (seconds): 90.48 System time (seconds): 0.30 Percent of CPU this job got: 103% Elapsed (wall clock) time (h:mm:ss or m:ss): 1:27.40 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 777056 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 3 Minor (reclaiming a frame) page faults: 18296 Voluntary context switches: 7426 Involuntary context switches: 26029 Swaps: 0 File system inputs: 7392 File system outputs: 11936 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 --8<---------------cut here---------------end--------------->8--- So there’s a peak at 758 MiB, which is arguably too much, but far from 5 GiB. Each evaluation forces a complete recompilation. However this is apparently not what takes the most memory: --8<---------------cut here---------------start------------->8--- $ \time -v ./pre-inst-env guile -l build-aux/hydra/gnu-system.scm -c '(use-modules (guix)) (with-store store (hydra-jobs store (list)))' ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/ludo/src/guix/build-aux/hydra/gnu-system.scm prepending "build-aux/hydra/../.." to the load path ;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/build-aux/hydra/gnu-system.scm.go prepending "build-aux/hydra/../.." to the load path Command being timed: "./pre-inst-env guile -l build-aux/hydra/gnu-system.scm -c (use-modules (guix)) (with-store store (hydra-jobs store (list)))" User time (seconds): 45.26 System time (seconds): 0.14 Percent of CPU this job got: 104% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:43.48 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 798912 --8<---------------cut here---------------end--------------->8--- The latter is faster, but uses about as much memory as the auto-compilation variant. For reference, loading all the package modules takes around 180 MiB: --8<---------------cut here---------------start------------->8--- $ \time -v guix build foobarbaz guix build: error: foobarbaz: unknown package Command exited with non-zero status 1 Command being timed: "guix build foobarbaz" User time (seconds): 0.31 System time (seconds): 0.03 Percent of CPU this job got: 64% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.53 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 181376 --8<---------------cut here---------------end--------------->8--- Anyway, we need to do actual heap profiling now. :-) Ludo’.