We recently updated to mercurial 4.6.2 on our servers and also increased number
of requests to be made on server at one time. This made hgweb instance takes up
a lot of memory, sometime upto 50GB of memory when requests are made parallely.
This patch is motivated from
https://www.mercurial-scm.org/repo/hg-committed/rev/ff2370a70fe8 which adds
gc.collect() call for the server which serves multiple repositories.
I tried profiling this fix, sometimes this shows less memory usage, sometimes
more, so I am not sure whether this is right and hence RFC tag.