Show More
@@ -8,6 +8,7 b'' | |||||
8 |
|
8 | |||
9 | from __future__ import absolute_import |
|
9 | from __future__ import absolute_import | |
10 |
|
10 | |||
|
11 | import gc | |||
11 | import os |
|
12 | import os | |
12 | import re |
|
13 | import re | |
13 | import time |
|
14 | import time | |
@@ -224,8 +225,18 b' class hgwebdir(object):' | |||||
224 | def run_wsgi(self, req): |
|
225 | def run_wsgi(self, req): | |
225 | profile = self.ui.configbool('profiling', 'enabled') |
|
226 | profile = self.ui.configbool('profiling', 'enabled') | |
226 | with profiling.profile(self.ui, enabled=profile): |
|
227 | with profiling.profile(self.ui, enabled=profile): | |
227 | for r in self._runwsgi(req): |
|
228 | try: | |
228 | yield r |
|
229 | for r in self._runwsgi(req): | |
|
230 | yield r | |||
|
231 | finally: | |||
|
232 | # There are known cycles in localrepository that prevent | |||
|
233 | # those objects (and tons of held references) from being | |||
|
234 | # collected through normal refcounting. We mitigate those | |||
|
235 | # leaks by performing an explicit GC on every request. | |||
|
236 | # TODO remove this once leaks are fixed. | |||
|
237 | # TODO only run this on requests that create localrepository | |||
|
238 | # instances instead of every request. | |||
|
239 | gc.collect() | |||
229 |
|
240 | |||
230 | def _runwsgi(self, req): |
|
241 | def _runwsgi(self, req): | |
231 | try: |
|
242 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now