Re: Why does this leak memory?

2012-06-11 Thread Ulrich Eckhardt
Am 08.06.2012 18:02, schrieb Steve: > Well, I guess I was confused by the terminology. I thought there were > leaked objects _after_ a garbage collection had been run (as it said > "collecting generation 2"). Also, "unreachable" actually appears to mean > "unreferenced". You live n learn... Actual

Re: Why does this leak memory?

2012-06-08 Thread Ian Kelly
On Fri, Jun 8, 2012 at 10:02 AM, Steve wrote: > Well, I guess I was confused by the terminology. I thought there were leaked > objects _after_ a garbage collection had been run (as it said "collecting > generation 2"). That means that it's going to check all objects. The garbage collector divide

Re: Why does this leak memory?

2012-06-08 Thread Steve
"John Gordon" wrote in message news:jqr3v5$src$1...@reader1.panix.com... I'm unfamiliar with gc output, but just glancing over it I don't see anything that looks like a leak. It reported that there were 19 objects which are unreachable and therefore are candidates for being collected. What mak

Re: Why does this leak memory?

2012-06-07 Thread Ian Kelly
For comparison, here is what a leaking program would look like: class Foo(object): def __init__(self, other=None): if other is None: other = Foo(self) self.other = other def __del__(self): pass import gc gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_LEAK) f

Re: Why does this leak memory?

2012-06-07 Thread Ian Kelly
On Thu, Jun 7, 2012 at 12:48 PM, Steve wrote: > The leaks can be removed by uncommenting both lines shown. That's just a matter of timing. You call the function before you call set_debug, so when you uncomment the lines, the garbage collector is explicitly run before the debug flags are set. Wh

Re: Why does this leak memory?

2012-06-07 Thread John Gordon
In "Steve" writes: > gc: objects in each generation: 453 258 4553 > gc: collectable > gc: collectable > gc: collectable > gc: collectable <_Link 02713300> > gc: collectable > gc: collectable > gc: collectable > gc: collectable <_Link 02713350> > gc: collectable > gc: collectable > gc: co

Why does this leak memory?

2012-06-07 Thread Steve
When I run this program: import configparser, sys, gc def test(): config=configparser.ConfigParser() #del(config) #gc.collect() test() sys.stderr.write(sys.version) gc.set_debug(gc.DEBUG_LEAK|gc.DEBUG_STATS) It reports: 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)]