Skip to content

Commit

Permalink
Use a new test loader for each queue item.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Harry Kao committed Dec 22, 2015
1 parent 0f592c4 commit 02f7d84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nose/plugins/multiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -702,6 +700,8 @@ def batch(result):
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 = []
Expand Down

0 comments on commit 02f7d84

Please # to comment.