Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41532
| Date | 2013-03-19 12:02 -0400 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| Subject | Re: Wierd behavior of gc.collect |
| References | <76cc4613-8086-4b36-a8bd-8ad0f21a19e0@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3525.1363708963.2939.python-list@python.org> (permalink) |
On 03/19/2013 11:47 AM, Bodhi wrote: > I have a python process that does some operations and is supposed to release memory after those. The issue is that memory is not released (as seen through top). So I do a gc.collect() to see if there is any cycle etc. Immediately after doing the collect memory usage drops as expected, but strangely gc.collect() returns 0. > This means I cannot find out what the problem is by setting the debug option on gc which is what I usually do to figure out issues like this. > > Maybe its that my understanding about it is incorrect, but if gc.collect returned 0, how come some memory was freed? > To put it simply, top won't in general show you that things are freed. The C libraries for malloc and free will reuse the memory, but not usually release it to the operating system. So it's not usually going to show up in 'top.' There was a long thread on this quite recently, but I can't seem to find it right now. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 08:47 -0700
Re: Wierd behavior of gc.collect Dave Angel <davea@davea.name> - 2013-03-19 12:02 -0400
Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 09:36 -0700
Re: Wierd behavior of gc.collect Dave Angel <davea@davea.name> - 2013-03-19 13:13 -0400
Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 21:51 -0700
Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 21:51 -0700
Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 09:36 -0700
csiph-web