display: Remove circular references from intermediate context object

Explicilty clear the local context object so that it does not require
a gc sweep to free it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-09-16 23:15:00 -04:00
parent cb0a8f2ed9
commit cd23c95760
1 changed files with 1 additions and 0 deletions

View File

@ -79,6 +79,7 @@ class DisplayGroup:
for row, col, template in self.data_items: for row, col, template in self.data_items:
text = template.render(context) text = template.render(context)
display.draw_text(row, col, text.replace('\n', ''), eventtime) display.draw_text(row, col, text.replace('\n', ''), eventtime)
context.clear() # Remove circular references for better gc
class PrinterLCD: class PrinterLCD:
def __init__(self, config): def __init__(self, config):