From 281ef294fdf1bf246987984a6a7a3a5aca4d6517 Mon Sep 17 00:00:00 2001
From: Luke Shumaker <lukeshu@lukeshu.com>
Date: Sun, 1 Jan 2023 11:23:10 -0700
Subject: scripts/main.sh: Set GOMEMLIMIT based on system RAM

---
 scripts/main.sh | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'scripts')

diff --git a/scripts/main.sh b/scripts/main.sh
index 160aa42..d89f387 100755
--- a/scripts/main.sh
+++ b/scripts/main.sh
@@ -17,6 +17,8 @@ CGO_ENABLED=0 go build -trimpath ./cmd/btrfs-rec
 mkdir -p "$b.gen"
 { set +x; } &>/dev/null
 
+export GOMEMLIMIT="$(awk '/^MemTotal:/{ print $2 "KiB" }' </proc/meminfo)"
+
 gen $b.gen/0.scandevices.json \
     ./btrfs-rec --pv=$b.img \
     inspect scandevices
-- 
cgit v1.2.3-2-g168b