import gc import kaa @kaa.yield_execution() def foo(): yield kaa.YieldContinue print 'now I crash and nobody sees it' crash def garbage_collect(): gc.collect() for g in gc.garbage: # print information about garbage gc can't collect print 'Unable to free %s' % (g,) foo() kaa.Timer(garbage_collect).start(0.5) kaa.main.run()