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.
--- 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):