On Feb 10, 2010, at 9:48 PM, BrandonE wrote: > Hello all, > > I am converting one of my CGI Python applications to Pylons. Part of > it contains displaying a JSON encoded tree generated from a Python > list. It is a huge tree. It loads very quickly the first time I load > the page. The second time however, it seemed to be going slower. The > third, it didn't even complete. > > To investigate, I looked at the memory usage in my control panel > (Testing locally on a Windows 7 computer, but the original case > happened on one using Linux). It seemed that the first time, it took > up 116,000KB of memory. Although one might argue that my script should > never use that amount of memory to begin with, I consider that to be > relatively reasonable. However, when I load it the second time, it > doubles. I wonder, why is that? That is when I discovered this link: > > http://effbot.org/pyfaq/why-doesnt-python-release-the-memory-when-i-delete-a-large-object.htm > > So, it seems that Python frees up memory, but not to the OS. OK, that > seems fairly reasonable. However, unlike CGI, Pylons runs constantly, > even after a page has been loaded. That makes sense to me, but it > seems like Pylons isn't accessing the memory that it just allocated in > the previous load. I wonder why that is.
There's a memory leak -- something is holding on to the previous request's memory. The Dozer WSGI app can help you find what's holding onto it, e.g.: http://amix.dk/blog/post/19420 > > Although this could potentially be an issue with Python, WSGI, or > Pylons, I figure this is the best place to post it as it is the > specific possible factor in this malfunction, and that the experts > here will know about the former two. Although some might want to tell > me to use less memory altogether, I would like to mention that the > same increase occured in other Pylons instances with much smaller > consumption, although the increase was proportional. > -- Philip Jenvey -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.