On Mon, Jul 19, 2010 at 6:30 PM, Vishal Rana <ranavis...@gmail.com> wrote: > Hi, > In my web application (Django) I call a function for some request which > loads like 500 MB data from the database uses it to do some calculation and > stores the output in disk. I just wonder even after this request is served > the apache / python process is still shows using that 500 MB, why is it so? > Can't I release that memory?
http://effbot.org/pyfaq/why-doesnt-python-release-the-memory-when-i-delete-a-large-object.htm There are multiple layers of memory allocation involved. To avoid thrashing+fragmentation and to improve efficiency, free memory is not always immediately returned to the operating system. Example: If your problem involved calling your 500MB function twice, free-ing after the first call and then immediately re-allocating another 500MB of memory for the second call would waste time. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list