From c842f46bbdd2ba686d6995b3a92b61a807c5515e Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Mon, 6 Dec 2021 09:58:00 +0100 Subject: [PATCH] tests/leaks.sh: increase tolerances again Another day, another attempt to quash regress test fails caused by implausibly small memory "leaks". Apparently, on later macOS versions, 'ps' got more unreliable, so increase tolerance from 8 to 12 bytes. Maximum reported leaks.sh failure was 188 KiB after 16384 iterations (11 bytes/iteration). And on some Linux versions, /proc sometimes acts weird. The following is apparently consistent on Arch Linux: shcomp-leaks.ksh[177]: memory leak with read -C when using <<< (leaked approx 65536 bytes after 4096 iterations) ...which is 16 bytes per iteration, still not large enough to make a real leak plausible. Resolves: https://github.com/ksh93/ksh/issues/363 --- src/cmd/ksh93/tests/leaks.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/ksh93/tests/leaks.sh b/src/cmd/ksh93/tests/leaks.sh index 256cb4644..51aef3da0 100755 --- a/src/cmd/ksh93/tests/leaks.sh +++ b/src/cmd/ksh93/tests/leaks.sh @@ -39,7 +39,7 @@ then N=512 # number of iterations for each test elif [[ -f /proc/$$/stat && $(uname) == Linux ]] then N=4096 # number of iterations for each test unit=bytes - tolerance=$((9*N)) # tolerate 9 bytes per iteration to account for malloc artefacts + tolerance=$((16*N)) # tolerate 16 bytes per iteration to account for malloc artefacts function getmem { cut -f 23 -d ' ' /dev/null) && let "($n) == ($n) && n > 0" then N=16384 unit=KiB - tolerance=$((8*N/1024)) # tolerate 8 bytes per iteration to account for malloc/ps artefacts + tolerance=$((12*N/1024))# tolerate 12 bytes per iteration to account for malloc/ps artefacts function getmem { ps -o rss= -p "$$"