From 02f7d848e4924264f81d3753673db53a93ae1c13 Mon Sep 17 00:00:00 2001 From: Harry Kao Date: Tue, 22 Dec 2015 14:09:45 -0800 Subject: Use a new test loader for each queue item. The loader's ContextSuiteFactory keeps a reference to all of the test suites, even after they've been run, which consumes more and more memory over time. This change creates a new loader for each suite that's dispatched to the worker, which allows the GC to free the old test suites. --- nose/plugins/multiprocess.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nose/plugins/multiprocess.py b/nose/plugins/multiprocess.py index 2cae744..135d69c 100644 --- a/nose/plugins/multiprocess.py +++ b/nose/plugins/multiprocess.py @@ -668,8 +668,6 @@ def __runner(ix, testQueue, resultQueue, currentaddr, currentstart, config.plugins.configure(config.options,config) config.plugins.begin() log.debug("Worker %s executing, pid=%d", ix,os.getpid()) - loader = loaderClass(config=config) - loader.suiteClass.suiteClass = NoSharedFixtureContextSuite def get(): return testQueue.get(timeout=config.multiprocess_timeout) @@ -702,6 +700,8 @@ def __runner(ix, testQueue, resultQueue, currentaddr, currentstart, log.exception('Worker %d STOPPED',ix) break result = makeResult() + loader = loaderClass(config=config) + loader.suiteClass.suiteClass = NoSharedFixtureContextSuite test = loader.loadTestsFromNames([test_addr]) test.testQueue = testQueue test.tasks = [] -- cgit v1.2.1