]> code.ossystems Code Review - openembedded-core.git/commitdiff
Reduce bb.cache memory usage a bit
authorChris Larson <chris_larson@mentor.com>
Thu, 23 Sep 2010 18:21:29 +0000 (11:21 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 4 Jan 2011 14:46:36 +0000 (14:46 +0000)
- Don't store key/value pairs when the value is None
- Delete the depends_cache when we're done with it

This reduces the memory usage after sync on initial parse by roughly 11.5% on
this machine.

(Bitbake rev: c7eb4c989459d182fdf9c81a627d32b7ef11626b)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/cache.py

index 255c6168dd0725b0bc80a1ba9c32f8cc0dc75bf2..7ec55bc1be0a1061d50b787be2793ceaffa81e5e 100644 (file)
@@ -118,7 +118,8 @@ class Cache:
 
         self.cacheclean = False
         result = bb.data.getVar(var, self.data, exp)
-        self.depends_cache[fn][var] = result
+        if result is not None:
+            self.depends_cache[fn][var] = result
         return result
 
     def setData(self, virtualfn, fn, data):
@@ -219,7 +220,6 @@ class Cache:
                 virtuals += 1
         return False, skipped, virtuals
 
-
     def cacheValid(self, fn):
         """
         Is the cache valid for fn?
@@ -346,6 +346,7 @@ class Cache:
 
         p = pickle.Pickler(file(self.cachefile, "wb" ), -1 )
         p.dump([cache_data, version_data])
+        del self.depends_cache
 
     def mtime(self, cachefile):
         return bb.parse.cached_mtime_noerror(cachefile)