]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Break up a reference cycle with RequestHandler.ui when handler exits cleanly.
authorBen Darnell <ben@bendarnell.com>
Sun, 14 Apr 2013 19:58:02 +0000 (15:58 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 14 Apr 2013 19:59:20 +0000 (15:59 -0400)
This is not strictly necessary, but allows for CPython's refcounting
GC to reclaim the handler sooner than waiting for a full GC.

Closes #383.

tornado/web.py

index cf43c36ad3016e81ee4ae2fa0ce7ea032d86cb2e..cb1af173bbe346fb270d6b2cc454ab92157171f8 100644 (file)
@@ -747,6 +747,9 @@ class RequestHandler(object):
             self._log()
         self._finished = True
         self.on_finish()
+        # Break up a reference cycle between this handler and the
+        # _ui_module closures to allow for faster GC on CPython.
+        self.ui = None
 
     def send_error(self, status_code=500, **kwargs):
         """Sends the given HTTP error code to the browser.