[meld] Limit number of tasks per child process to avoid memory issues
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Limit number of tasks per child process to avoid memory issues
- Date: Wed, 17 Oct 2012 21:33:05 +0000 (UTC)
commit c8cd2b792a21648836cf3db847af5c1dce018492
Author: Kai Willadsen <kai willadsen gmail com>
Date: Thu Oct 18 05:54:50 2012 +1000
Limit number of tasks per child process to avoid memory issues
Child processes (most obvious on e.g., 8-core systems) can take up
significant chunks of memory in proportion to the main Meld process.
This commit just limits the number of tasks delegated to a child before
it terminates, which 'fixes' the problem.
meld/filediff.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index ada1409..51c18e8 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -55,7 +55,11 @@ def matcher_worker(text1, textn):
matcher = matchers.InlineMyersSequenceMatcher(None, text1, textn)
return matcher.get_opcodes()
-process_pool = multiprocessing.Pool(None, init_worker)
+# maxtasksperchild is new in Python 2.7; for 2.6 compat we do this
+try:
+ process_pool = multiprocessing.Pool(None, init_worker, maxtasksperchild=1)
+except TypeError:
+ process_pool = multiprocessing.Pool(None, init_worker)
class CachedSequenceMatcher(object):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]