changeset 13436:b391c0c9be61 stable

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.
author Wagner Bruna <wbruna@softwareexpress.com.br>
date Thu, 17 Feb 2011 18:05:27 -0200
parents 90d7ce986565
children 6169493ac3f9
files mercurial/hgweb/hgwebdir_mod.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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):