Add a gc.collect() call inside iter_owers(), since people are reporting
authorZac Medico <zmedico@gentoo.org>
Sun, 25 Jul 2010 18:23:28 +0000 (11:23 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 25 Jul 2010 18:23:28 +0000 (11:23 -0700)
high memory usage there. We should really only use this function to search
for a small number of files. Larger numbers of files should use a different
algorithm that will ensure that each CONTENTS file is only parsed once.

pym/portage/dbapi/vartree.py

index 5a98c7e06f0e86ad69ae8043c4226f6136d507be..668cbda637c6de6de93a9dff45b72a328b938c4c 100644 (file)
@@ -52,6 +52,7 @@ from portage.cache.mappings import slot_dict_class
 
 import codecs
 from collections import deque
+import gc
 import re, shutil, stat, errno, copy, subprocess
 import logging
 import os as _os
@@ -1658,6 +1659,7 @@ class vardbapi(dbapi):
                                        if len(dblink_fifo) >= 100:
                                                # Ensure that we don't run out of memory.
                                                del dblink_cache[dblink_fifo.popleft().mycpv]
+                                               gc.collect()
                                        x = self._vardb._dblink(cpv)
                                        dblink_cache[cpv] = x
                                        dblink_fifo.append(x)