summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-25 10:06:42 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-25 10:06:42 +0000
commitdb0da5c2732387f9e935d0603efd01b51267470e (patch)
tree8a124991297a8a733bb74ff0f506273e7a4dd15e
parent5da51eb9ab2e8b0c2e6c1a895b8e07bc98a6d2ea (diff)
downloadportage-db0da5c2732387f9e935d0603efd01b51267470e.tar.gz
portage-db0da5c2732387f9e935d0603efd01b51267470e.tar.bz2
portage-db0da5c2732387f9e935d0603efd01b51267470e.zip
After the depgraph caches the vardb state in a FakeVartree, to make
some room on the heap, clear the vardbapi caches. svn path=/main/trunk/; revision=10782
-rw-r--r--pym/_emerge/__init__.py8
-rw-r--r--pym/portage/dbapi/vartree.py12
2 files changed, 17 insertions, 3 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 7b6dc6e40..b5b726151 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -2025,6 +2025,14 @@ class depgraph(object):
# This triggers metadata updates via FakeVartree.
vardb.aux_get(pkg.cpv, [])
fakedb.cpv_inject(pkg)
+
+ # Now that the vardb state is cached in our FakeVartree,
+ # we won't be needing the real vartree cache for awhile.
+ # To make some room on the heap, clear the vardbapi
+ # caches.
+ trees[myroot]["vartree"].dbapi._clear_cache()
+ gc.collect()
+
self.mydbapi[myroot] = fakedb
def graph_tree():
pass
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 80738662f..38fa50c4a 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -551,13 +551,19 @@ class vardbapi(dbapi):
def checkblockers(self, origdep):
pass
+ def _clear_cache(self):
+ self.mtdircache.clear()
+ self.matchcache.clear()
+ self.cpcache.clear()
+ self._aux_cache_obj = None
+
def _add(self, pkg_dblink):
- self._clear_cache(pkg_dblink)
+ self._clear_pkg_cache(pkg_dblink)
def _remove(self, pkg_dblink):
- self._clear_cache(pkg_dblink)
+ self._clear_pkg_cache(pkg_dblink)
- def _clear_cache(self, pkg_dblink):
+ def _clear_pkg_cache(self, pkg_dblink):
# Due to 1 second mtime granularity in <python-2.5, mtime checks
# are not always sufficient to invalidate vardbapi caches. Therefore,
# the caches need to be actively invalidated here.