BORHANUDDIN1 / webapp-improved

Automatically exported from code.google.com/p/webapp-improved
Other
0 stars 0 forks source link

Reference loop in webapp2.Response #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
webapp2.Response.out creates a reference loop. Changing it to a property would 
avoid this.

Original issue reported on code.google.com by sa...@google.com on 23 Aug 2011 at 2:30

GoogleCodeExporter commented 9 years ago
What triggers the loop? A simple example would be appreciated.

Original comment by rodrigo.moraes on 24 Aug 2011 at 9:47

GoogleCodeExporter commented 9 years ago
It's triggered by creating a Response object. From an interactive session:
>>> import webapp2
>>> import gc
>>> gc.collect()
0
>>> x = webapp2.Response()
>>> del x
>>> gc.collect()
8
>>> x = webapp2.Response()
>>> del x.out
>>> del x
>>> gc.collect()
0

This causes problems in production when serving large responses. Memory usage 
increases by the size of the response each time and the instance tends to run 
out of memory.

Original comment by sa...@google.com on 24 Aug 2011 at 10:29

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 4b69d8bcdeb3.

Original comment by rodrigo.moraes on 24 Aug 2011 at 6:42