Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107052

Re: Python garbage collection: not releasing memory to OS!

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Newsgroups comp.lang.python
Subject Re: Python garbage collection: not releasing memory to OS!
Date 2016-04-15 08:24 -0400
Organization IISS Elusive Unicorn
Message-ID <mailman.20.1460723049.6324.python-list@python.org> (permalink)
References <215cf2a4-c2fa-41d0-8c49-23b9494234d4@googlegroups.com> <trm1hb16b6slo2qts756iv77kgkls0hgkm@4ax.com>

Show all headers | View raw


On Fri, 15 Apr 2016 03:25:39 -0700 (PDT), cshintov@gmail.com declaimed the
following:

>So if the celery worker is not killed after its task is finished it is going to keep the memory for itself. I know I can use **max_tasks_per_child** config value to kill the process and spawn a new one. **Is there any other way to return the memory to OS from a python process?.**

	How would you do that from any other process? If it's easy, I'd think
the Python devs would have considered adding it to the run-time.

	IOWs, the question is more likely to be "how does the OS reclaim memory
from running processes". In many operating systems -- it only does that
when cleaning up the entire process space. Memory allocated for the heap
seldom is reclaimed piecemeal as heap objects may be scattered throughout
the allocation and can't be moved.

	No idea how Windows could be different. Possibly it only counts pages
that actually have live data (how it determines that I don't know -- maybe
malloc/free use a system-wide pool of virtual memory so when a large enough
block of adjacent addresses is freed the entire page is returned to the
system, even though the process thinks it is using a contiguous allotment).
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python garbage collection: not releasing memory to OS! cshintov@gmail.com - 2016-04-15 03:25 -0700
  Re: Python garbage collection: not releasing memory to OS! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-04-15 08:24 -0400
  Re: Python garbage collection: not releasing memory to OS! Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-04-15 14:02 +0100
  Re: Python garbage collection: not releasing memory to OS! Michael Torrie <torriem@gmail.com> - 2016-04-15 07:59 -0600
  Re: Python garbage collection: not releasing memory to OS! Sam <python@net153.net> - 2016-04-15 09:27 -0500

csiph-web