hgwebdir: reduce memory usage for index generation stable
authorWagner Bruna <wbruna@softwareexpress.com.br>
Thu, 17 Feb 2011 18:05:27 -0200
branchstable
changeset 13436 b391c0c9be61
parent 13435 90d7ce986565
child 13437 6169493ac3f9
hgwebdir: reduce memory usage for index generation The archive list generator was holding a reference to each temporary ui copy passed by rawentries(), so the memory usage for index generation growed proportionally to the ui object size and the amount of repositories. By returning a list instead, the temporary reference is dropped immediately.
mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Thu Feb 17 13:37:52 2011 -0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Thu Feb 17 18:05:27 2011 -0200
@@ -203,11 +203,13 @@
 
         def archivelist(ui, nodeid, url):
             allowed = ui.configlist("web", "allow_archive", untrusted=True)
+            archives = []
             for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
                 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
                                                     untrusted=True):
-                    yield {"type" : i[0], "extension": i[1],
-                           "node": nodeid, "url": url}
+                    archives.append({"type" : i[0], "extension": i[1],
+                                     "node": nodeid, "url": url})
+            return archives
 
         def rawentries(subdir="", **map):