How is memory managed in python?

Vishal Rana ranavishal at gmail.com
Tue Jul 20 11:49:44 EDT 2010


Chris,

Thanks for the link.


On Mon, Jul 19, 2010 at 11:43 PM, Chris Rebert <clp2 at rebertia.com> wrote:

> On Mon, Jul 19, 2010 at 6:30 PM, Vishal Rana <ranavishal at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100720/4732b420/attachment.html>


More information about the Python-list mailing list