Commits

Robert Brewer  committed c1a604d

Fix for #496 (memory leak in threadlocal objects).

  • Participants
  • Parent commits 3932b98

Comments (0)

Files changed (2)

File cherrypy/_cphttptools.py

         if not self.closed:
             self.closed = True
             applyFilters('on_end_request', failsafe=True)
+            cherrypy.serving.__dict__.clear()
+            cherrypy.thread_data.__dict__.clear()
     
     def run(self, requestLine, headers, rfile):
         """Process the Request.

File cherrypy/_cpwsgi.py

             yield chunk
         if request:
             request.close()
+        request = None
     except (KeyboardInterrupt, SystemExit), ex:
         try:
             if request:
                 request.close()
         except:
             cherrypy.log(traceback=True)
+        request = None
         raise ex
     except:
         cherrypy.log(traceback=True)
                 request.close()
         except:
             cherrypy.log(traceback=True)
+        request = None
         s, h, b = _cputil.bareError()
         # CherryPy test suite expects bareError body to be output,
         # so don't call start_response (which, according to PEP 333,