Re: [Tutor] garbage collecting

2014-01-08 Thread Keith Winston
On Thu, Jan 9, 2014 at 12:27 AM, eryksun wrote: > The old float freelist was the same design as the one for 2.x int > (PyInt, not PyLong), which grows without bound. The design also > allocates objects in 1 KiB blocks (approx. size). glibc's malloc will > use the heap for a block that's this smal

Re: [Tutor] garbage collecting

2014-01-08 Thread eryksun
On Wed, Jan 8, 2014 at 3:30 PM, Oscar Benjamin wrote: > The garbage collector has nothing to do with the memory usage of immutable > types like ints. There are deallocated instantly when the last reference you > hold is cleared (in CPython). So if you run out of memory because of them > then it is

Re: [Tutor] garbage collecting

2014-01-08 Thread Oscar Benjamin
On Jan 8, 2014 9:11 PM, "Keith Winston" wrote: > > > On Wed, Jan 8, 2014 at 3:30 PM, Oscar Benjamin wrote: >> >> The garbage collector has nothing to do with the memory usage of immutable types like ints. There are deallocated instantly when the last reference you hold is cleared (in CPython). So

Re: [Tutor] garbage collecting

2014-01-08 Thread Keith Winston
On Wed, Jan 8, 2014 at 3:30 PM, Oscar Benjamin wrote: > The garbage collector has nothing to do with the memory usage of immutable > types like ints. There are deallocated instantly when the last reference > you hold is cleared (in CPython). So if you run out of memory because of > them then it is

Re: [Tutor] garbage collecting

2014-01-08 Thread Oscar Benjamin
On Jan 8, 2014 5:51 PM, "Keith Winston" wrote: > > Well, thanks everyone. I get the picture. And there's nothing subtle going on here: I'm playing around, trying to factor million-digit numbers and the like. No biggie, this was interesting. Million digit numbers will use up some memory. Perhaps a

Re: [Tutor] garbage collecting

2014-01-08 Thread Keith Winston
Well, thanks everyone. I get the picture. And there's nothing subtle going on here: I'm playing around, trying to factor million-digit numbers and the like. No biggie, this was interesting. ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] garbage collecting

2014-01-08 Thread Steven D'Aprano
On Wed, Jan 08, 2014 at 12:43:06PM +0100, spir wrote: > [Just wildly guessing, don't know your app & code. Can you reduce it to a > minimal still manifesting similar bug?] Try (or rather, *don't* try): import sys list(range(sys.maxsize)) That ought to do it :-) (Note: depending on your opera

Re: [Tutor] garbage collecting

2014-01-08 Thread spir
On 01/08/2014 10:30 AM, Keith Winston wrote: well, fair enough. Generally, the issue involves instances when Python will come back, but it might take several minutes or much longer. And weird behaviour ensues: like timers I put on the program don't actually time the amount of time it's busy (by a

Re: [Tutor] garbage collecting

2014-01-08 Thread Alan Gauld
On 08/01/14 10:50, Mark Lawrence wrote: On 08/01/2014 10:41, Alan Gauld wrote: On 08/01/14 08:15, Mark Lawrence wrote: Did I? :) Oops, one too many lines deleted. Sorry Mark. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldph

Re: [Tutor] garbage collecting

2014-01-08 Thread Steven D'Aprano
On Tue, Jan 07, 2014 at 11:41:53PM -0500, Keith Winston wrote: > Iirc, Python periodically cleans memory of bits & pieces that are no longer > being used. I periodically do something stupid -- I mean experimental -- > and end up with a semi-locked up system. Sometimes it comes back, > sometimes eve

Re: [Tutor] garbage collecting

2014-01-08 Thread Mark Lawrence
On 08/01/2014 10:41, Alan Gauld wrote: On 08/01/14 08:15, Mark Lawrence wrote: Did I? :) I just saw where I could do os.system('python'), but in restarting the interpreter I'd lose everything currently loaded: my real question involves merely pushing the garbage collector into action, I thi

Re: [Tutor] garbage collecting

2014-01-08 Thread Alan Gauld
On 08/01/14 08:15, Mark Lawrence wrote: I just saw where I could do os.system('python'), but in restarting the interpreter I'd lose everything currently loaded: my real question involves merely pushing the garbage collector into action, I think. Don't do that! You are not restarting the interp

Re: [Tutor] garbage collecting

2014-01-08 Thread Mark Lawrence
On 08/01/2014 09:30, Keith Winston wrote: well, fair enough. Generally, the issue involves instances when Python will come back, but it might take several minutes or much longer. And weird behaviour ensues: like timers I put on the program don't actually time the amount of time it's busy (by a ve

Re: [Tutor] garbage collecting

2014-01-08 Thread Keith Winston
well, fair enough. Generally, the issue involves instances when Python will come back, but it might take several minutes or much longer. And weird behaviour ensues: like timers I put on the program don't actually time the amount of time it's busy (by a very, very large margin). Also, often several

Re: [Tutor] garbage collecting

2014-01-08 Thread Mark Lawrence
On 08/01/2014 04:41, Keith Winston wrote: Iirc, Python periodically cleans memory of bits & pieces that are no longer being used. I periodically do something stupid -- I mean experimental -- and end up with a semi-locked up system. Sometimes it comes back, sometimes everything after that point r

[Tutor] garbage collecting

2014-01-07 Thread Keith Winston
Iirc, Python periodically cleans memory of bits & pieces that are no longer being used. I periodically do something stupid -- I mean experimental -- and end up with a semi-locked up system. Sometimes it comes back, sometimes everything after that point runs very slowly, etc. I just saw where I cou