reactor: Add support for explicit Python garbage collection

Add support for performing Python gc work only from the main reactor
thread and only when it appears the main thread is idle.

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

View file

@ -306,6 +306,7 @@ def main():
elif not options.debugoutput:
logging.warning("No log file specified!"
" Severe timing issues may result!")
gc.disable()
# Start Printer() class
while 1:
@ -313,7 +314,7 @@ def main():
bglogger.clear_rollover_info()
bglogger.set_rollover_info('versions', versions)
gc.collect()
main_reactor = reactor.Reactor()
main_reactor = reactor.Reactor(gc_checking=True)
printer = Printer(main_reactor, bglogger, start_args)
res = printer.run()
if res in ['exit', 'error_exit']: