summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2022-06-11 17:58:15 +0000
committerrillig <rillig@NetBSD.org>2022-06-11 17:58:15 +0000
commit031fec0a1457033d4ef46b548bfb9308a2222212 (patch)
tree761643251e4cbb9b6771a1ceba9adafcc576ff57 /sys/dev
parentb3f0b1c708c727243c90f04fb4f6bd55dbeefdb4 (diff)
make: fix memory leak in wildcard targets and sources
$ cat <<'EOF' > glob-leak.mk all: @pid=$$$$; \ ppid=$$(ps -o ppid -p "$$pid" | sed 1d); \ ps -o vsz,rsz -p $$ppid | sed 1d .for _ in ${:U:${:Urange=$n}} bin/*: source .endfor EOF $ make.before -r -f glob-leak.mk n=1 19424 5280 $ make.before -r -f glob-leak.mk n=10 24220 10208 $ make.before -r -f glob-leak.mk n=100 71280 58504 $ make.before -r -f glob-leak.mk n=1000 556356 541620 $ make.after -r -f glob-leak.mk n=1 19208 5040 $ make.after -r -f glob-leak.mk n=10 22132 8092 $ make.after -r -f glob-leak.mk n=100 49040 35940 $ make.after -r -f glob-leak.mk n=1000 324160 314400 That's a saving of 40% already. The remaining 60% are suspicious as well since after the first iteration of the .for loop, make's internal state doesn't change conceptually, so there's no need to throw more memory at it.
Diffstat (limited to 'sys/dev')
0 files changed, 0 insertions, 0 deletions