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.

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.

Thank you,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to