summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-24 05:52:48 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-24 05:52:48 +0000
commit5ca41dcbfd5a96c36e3461fd134e44449a74dac5 (patch)
tree8940ece42786bbb43e4787b4587403f5faba17e0
parentaf155c2e1ab6428dfd6be251af514aef11443454 (diff)
downloadportage-5ca41dcbfd5a96c36e3461fd134e44449a74dac5.tar.gz
portage-5ca41dcbfd5a96c36e3461fd134e44449a74dac5.tar.bz2
portage-5ca41dcbfd5a96c36e3461fd134e44449a74dac5.zip
Clear dbapi caches just after deleting the depgraph in action_build().
This trims down the heap size by a few megs, for bug #229069. svn path=/main/trunk/; revision=10769
-rw-r--r--pym/_emerge/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 6593ac48c..ad91dde7a 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -20,6 +20,7 @@ try:
except KeyboardInterrupt:
sys.exit(1)
+import gc
import os, stat
import platform
@@ -8739,6 +8740,8 @@ def action_build(settings, trees, mtimedb,
time.sleep(3) # allow the parent to have first fetch
mymergelist = mydepgraph.altlist()
del mydepgraph
+ clear_caches(trees)
+
retval = mergetask.merge(mymergelist, favorites, mtimedb)
merge_count = mergetask.curval
else:
@@ -8780,6 +8783,8 @@ def action_build(settings, trees, mtimedb,
pkglist = mydepgraph.altlist()
mydepgraph.saveNomergeFavorites()
del mydepgraph
+ clear_caches(trees)
+
mergetask = MergeTask(settings, trees, myopts)
retval = mergetask.merge(pkglist, favorites, mtimedb)
merge_count = mergetask.curval
@@ -8903,6 +8908,14 @@ def validate_ebuild_environment(trees):
settings = trees[myroot]["vartree"].settings
settings.validate()
+def clear_caches(trees):
+ for d in trees.itervalues():
+ d["porttree"].dbapi.melt()
+ d["porttree"].dbapi._aux_cache.clear()
+ d["bintree"].dbapi._aux_cache.clear()
+ d["bintree"].dbapi._clear_cache()
+ gc.collect()
+
def load_emerge_config(trees=None):
kwargs = {}
for k, envvar in (("config_root", "PORTAGE_CONFIGROOT"), ("target_root", "ROOT")):