After the depgraph caches the vardb state in a FakeVartree, to make
authorZac Medico <zmedico@gentoo.org>
Wed, 25 Jun 2008 10:06:42 +0000 (10:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 25 Jun 2008 10:06:42 +0000 (10:06 -0000)
some room on the heap, clear the vardbapi caches.

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

pym/_emerge/__init__.py
pym/portage/dbapi/vartree.py

index 7b6dc6e4086c65d2e6672f7041b1545ae60735ac..b5b7261515669e5b417207360ade86888ec0979b 100644 (file)
@@ -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
index 80738662fd007675e2b95a4dbf9b8309b661b8ec..38fa50c4a7ee1865ac8df90d95c23cfcd0655ac0 100644 (file)
@@ -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.