Fix memory leak during parallel writing with multiplied warnings.

This commit is contained in:
Georg Brandl 2014-12-31 15:04:48 +01:00
parent 25f3266def
commit 704619878e
2 changed files with 9 additions and 3 deletions

View File

@ -357,9 +357,11 @@ class Builder(object):
def _write_parallel(self, docnames, warnings, nproc):
def write_process(docs):
local_warnings = []
self.env.set_warnfunc(lambda *args: local_warnings.append(args))
for docname, doctree in docs:
self.write_doc(docname, doctree)
return warnings
return local_warnings
def add_warnings(docs, wlist):
warnings.extend(wlist)

View File

@ -101,7 +101,9 @@ class ParallelTasks(object):
del self._threads[tid]
if exc:
raise SphinxParallelError(*result)
self._result_funcs.pop(tid)(arg, result)
result_func = self._result_funcs.pop(tid)(arg, result)
if result_func:
result_func(result)
self._nprocessed += 1
def join(self):
@ -110,7 +112,9 @@ class ParallelTasks(object):
del self._threads[tid]
if exc:
raise SphinxParallelError(*result)
self._result_funcs.pop(tid)(arg, result)
result_func = self._result_funcs.pop(tid)(arg, result)
if result_func:
result_func(result)
self._nprocessed += 1
# there shouldn't be any threads left...