commit:     a0f48531213976c20190e61dea7100b190f5139f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  5 06:02:42 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar  5 08:16:19 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a0f48531

portdbapi.aux_get: don't cache in memory unless frozen

Fix the portdbapi aux_get method to cache metadata in memory only when
the "frozen" flag has been set, so that applications do not consume more
memory than necessary. This change does not affect depgraph performance,
since depgraph caches the metadata separately (in Package instances).

X-Gentoo-Bug: 576488
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=576488
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/portage/dbapi/porttree.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 23f3169..1f4374e 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -550,7 +550,7 @@ class portdbapi(dbapi):
                #finally, we look at our internal cache entry and return the 
requested data.
                returnme = [mydata.get(x, "") for x in mylist]
 
-               if cache_me:
+               if cache_me and self.frozen:
                        aux_cache = {}
                        for x in self._aux_cache_keys:
                                aux_cache[x] = mydata.get(x, "")
@@ -817,6 +817,7 @@ class portdbapi(dbapi):
 
        def melt(self):
                self.xcache = {}
+               self._aux_cache = {}
                self.frozen = 0
 
        def xmatch(self,level,origdep,mydep=None,mykey=None,mylist=None):

Reply via email to