From b5c4f35c4cd68a15cb268793d4f1d672964c26b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Thu, 4 Aug 2022 08:48:42 +0200 Subject: [PATCH] Limit JOBS to 2 on low memory 64bit systems --- build-soft-latest.sh | 6 ++++++ build-soft-stable.sh | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/build-soft-latest.sh b/build-soft-latest.sh index 8834f60..efa5f6c 100755 --- a/build-soft-latest.sh +++ b/build-soft-latest.sh @@ -7,6 +7,12 @@ CHECKOUT=0 ROOTDIR="$HOME/astro-soft" JOBS=$(grep -c ^processor /proc/cpuinfo) +# 64 bit systems need more memory for compilation +if [ $(getconf LONG_BIT) -eq 64 ] && [ $(grep MemTotal < /proc/meminfo | cut -f 2 -d ':' | sed s/kB//) -lt 5000000 ] +then + echo "Low memory limiting to JOBS=2" + JOBS=2 +fi [ ! -d "$ROOTDIR" ] && mkdir $ROOTDIR cd "$ROOTDIR" diff --git a/build-soft-stable.sh b/build-soft-stable.sh index 7083f9d..9223ed8 100755 --- a/build-soft-stable.sh +++ b/build-soft-stable.sh @@ -12,6 +12,13 @@ ROOTDIR="$HOME/astro-soft-stable" JOBS=$(grep -c ^processor /proc/cpuinfo) +# 64 bit systems need more memory for compilation +if [ $(getconf LONG_BIT) -eq 64 ] && [ $(grep MemTotal < /proc/meminfo | cut -f 2 -d ':' | sed s/kB//) -lt 5000000 ] +then + echo "Low memory limiting to JOBS=2" + JOBS=2 +fi + [ ! -d "$ROOTDIR" ] && mkdir $ROOTDIR cd "$ROOTDIR"