From a7121b668910295058dbe0913e3fe9570ba0e939 Mon Sep 17 00:00:00 2001 From: Lev Kujawski <77709387+lev105@users.noreply.github.com> Date: Fri, 12 Feb 2021 17:52:54 -0700 Subject: [PATCH] Implement leak detection on UnixWare (#172) src/cmd/ksh93/tests/leaks.sh: Read vsz from UnixWare's ps UnixWare's ps reports an accurate virtual size, so collecting that is preferable to trying to parse the real resident size. --- src/cmd/ksh93/tests/leaks.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cmd/ksh93/tests/leaks.sh b/src/cmd/ksh93/tests/leaks.sh index a4886ed76..b800bf90d 100755 --- a/src/cmd/ksh93/tests/leaks.sh +++ b/src/cmd/ksh93/tests/leaks.sh @@ -53,6 +53,17 @@ then N=1024 # number of iterations for each test { cut -f 23 -d ' ' /dev/null) && + let "($n) == ($n) && n > 0" +then N=16384 + unit=KiB + tolerance=$((4*N/1024)) # tolerate 4 bytes per iteration to account for malloc artefacts + function getmem + { + ps -o vsz= -p "$$" + } # Otherwise, make do with the nonstandard 'rss' (real resident size) keyword # of the 'ps' command (the standard 'vsz', virtual size, is not usable). elif n=$(ps -o rss= -p "$$" 2>/dev/null) &&