From ce6cc3821fcfcaba180bf7a818512a38234db82d Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Sat, 16 Jan 2021 00:06:21 +0800 Subject: [PATCH] [device/accton]: As7816-64x, fix memory leakage on accton fan monitor. (#6168) It's been reported that accton fan monitor process keeps consuming memory after few days. The amount of memory occupied increases in linear and never leased. Signed-off-by: roy_lee --- .../as7816-64x/utils/accton_as7816_monitor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py index 3d9f6fc3ce..06be9fc8ba 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py @@ -60,6 +60,9 @@ class accton_as7816_monitor(object): def __init__(self, log_file, log_level): """Needs a logger and a logger level.""" + + self.thermal = ThermalUtil() + self.fan = FanUtil() # set up logging to file logging.basicConfig( filename=log_file, @@ -89,8 +92,8 @@ class accton_as7816_monitor(object): 4: [max_duty, 57000, sys.maxsize], } - thermal = ThermalUtil() - fan = FanUtil() + thermal = self.thermal + fan = self.fan for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): fan_status = fan.get_fan_status(x) if fan_status is None: