Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] portdbapi.aux_get: don't cache in memory unless frozen
Date: Sun, 06 Mar 2016 12:32:40
Message-Id: 1457162099-15478-1-git-send-email-zmedico@gentoo.org
1 Fix the portdbapi aux_get method to cache metadata in memory only when
2 the "frozen" flag has been set, so that applications do not consume more
3 memory than necessary. This change does not affect depgraph performance,
4 since depgraph caches the metadata separately (in Package instances).
5
6 X-Gentoo-Bug: 576488
7 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=576488
8 ---
9 pym/portage/dbapi/porttree.py | 3 ++-
10 1 file changed, 2 insertions(+), 1 deletion(-)
11
12 diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
13 index 23f3169..1f4374e 100644
14 --- a/pym/portage/dbapi/porttree.py
15 +++ b/pym/portage/dbapi/porttree.py
16 @@ -550,7 +550,7 @@ class portdbapi(dbapi):
17 #finally, we look at our internal cache entry and return the requested data.
18 returnme = [mydata.get(x, "") for x in mylist]
19
20 - if cache_me:
21 + if cache_me and self.frozen:
22 aux_cache = {}
23 for x in self._aux_cache_keys:
24 aux_cache[x] = mydata.get(x, "")
25 @@ -817,6 +817,7 @@ class portdbapi(dbapi):
26
27 def melt(self):
28 self.xcache = {}
29 + self._aux_cache = {}
30 self.frozen = 0
31
32 def xmatch(self,level,origdep,mydep=None,mykey=None,mylist=None):
33 --
34 2.4.10

Replies