update.py: fix memory leaks

We're kind of abusing some bitbake internals here and the result is that
there are a bunch of global lists and caches that simply grow as we
parse more layers, until available memory is exhausted. We don't care
about the contents of any of these within the layer index update script
so just clear them out between layers.

Should fix [YOCTO #7663].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2015-06-15 00:02:16 +01:00
parent 2be084de64
commit f4b4525858

View File

@ -582,6 +582,19 @@ def main():
transaction.rollback() transaction.rollback()
else: else:
transaction.commit() transaction.commit()
# Slightly hacky way of avoiding memory leaks
bb.event.ui_queue = []
bb.parse.parse_py.BBHandler.cached_statements = {}
bb.codeparser.codeparsercache = bb.codeparser.CodeParserCache()
bb.codeparser.codecache = bb.codeparser.SetCache()
bb.fetch._checksum_cache = bb.checksum.FileChecksumCache()
bb.fetch.urldata_cache = {}
bb.fetch.saved_headrevs = {}
bb.parse.__pkgsplit_cache__={}
bb.parse.__mtime_cache = {}
bb.parse.init_parser(tinfoil.config_data)
except KeyboardInterrupt: except KeyboardInterrupt:
transaction.rollback() transaction.rollback()
logger.warn("Update interrupted, changes to %s rolled back" % layer.name) logger.warn("Update interrupted, changes to %s rolled back" % layer.name)