Bug #228075 - Explicitly call gc.collect() to try and free memory
authorZac Medico <zmedico@gentoo.org>
Wed, 18 Jun 2008 21:33:30 +0000 (21:33 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 18 Jun 2008 21:33:30 +0000 (21:33 -0000)
when checking for blockers. This avoids a heap overflow that triggers
'Cannot allocate memory' errors (reported with python-2.5).

svn path=/main/trunk/; revision=10717

pym/_emerge/__init__.py

index 0fa6befbe1ed2927ed4bd137fabd1a6404f1ebab..fab9cece3b30f5698f5e4b77d3831a39adea365f 100644 (file)
@@ -5825,6 +5825,12 @@ class MergeTask(object):
                if self._opts_ignore_blockers.intersection(self.myopts):
                        return None
 
+               # Call gc.collect() here to avoid heap overflow that
+               # triggers 'Cannot allocate memory' errors (reported
+               # with python-2.5).
+               import gc
+               gc.collect()
+
                blocker_dblinks = []
                for blocking_pkg in self._blocker_db[
                        new_pkg.root].findInstalledBlockers(new_pkg,
@@ -5838,6 +5844,8 @@ class MergeTask(object):
                                self.pkgsettings[blocking_pkg.root], treetype="vartree",
                                vartree=self.trees[blocking_pkg.root]["vartree"]))
 
+               gc.collect()
+
                return blocker_dblinks
 
        def merge(self, mylist, favorites, mtimedb):