[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 <roy_lee@edge-core.com>
This commit is contained in:
Roy Lee 2021-01-16 00:06:21 +08:00 committed by GitHub
parent ffcef27eb1
commit c9d3e25115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,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,
@ -83,8 +86,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: