From 096a5fc953d78246884beba49363a9113d110365 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 25 Jun 2015 10:34:52 +0000 Subject: [PATCH] fancontrol: Reduce memory consumption Construct "wait $!" causes bash to remember the exit status of the children. This consumes memory. We don't need the status code and we are only waiting for a single child, so we can simply use "wait". This will reduce the memory usage. This partly fixes ticket #2391. http://www.lm-sensors.org/ticket/2391 The actual leak is in bash 4.3 and should be fixed there. --- CHANGES | 1 + prog/pwm/fancontrol | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 30880b69..fa36d84a 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ SVN HEAD sensors: Add support for temperature min and critical min hysteresis fancontrol: Deal with moving hwmon attributes Fix shell error when FCFANS is not set + Reduce memory consumption (#2391) healthd: Avoid using external commands sensors-detect: Add detection of ADC128D818 Add detection of AMD family 16h Kabini and Mullins diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 85aa8bc9..9030438c 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -546,7 +546,7 @@ function UpdateFanSpeeds echo $minsa > $pwmo # Sleep while still handling signals sleep 1 & - wait $! + wait fi fi echo $pwmval > $pwmo # write new value to pwm output @@ -585,5 +585,5 @@ do UpdateFanSpeeds # Sleep while still handling signals sleep $INTERVAL & - wait $! + wait done