Re: [Pyobjc-dev] threads + autoreleasepools
Brought to you by:
ronaldoussoren
From: <bb...@ma...> - 2003-02-16 02:52:59
|
On Saturday, Feb 15, 2003, at 18:18 US/Eastern, Just van Rossum wrote: > Btw. I still get one warning, just for calling > NSAutoreleasePool.pyobjcPushPool(): > > 2003-02-16 00:15:59.062 python2.3[9275] *** _NSAutoreleaseNoPool(): > Object 0x3bfa90 of class NSInvocation autoreleased with no pool in > place > - just leaking > > Kindof a chicken & egg problem I suppose... This is in your thread, correct? Any thread running w/a runloop will always have a top level autorelease pool. Non looping threads do not -- hence the error message. If so, then yes -- the NSInvocation used to cross the bridge (?) is being leaked. That is obviously bad. The stoopid, by-the-API, fix is to do something like: p = [NSAutoreleasePool new]; inv = [NSInvocation invocationWithMethodSignature: ...] [inv retain]; [p release]; Of course, this is a grossly inefficient thing to add to *every single method invocation from Python -> ObjC*. As it turns out, NSInvocation *does* implement -initWithMethodSignature:. It just isn't declared in the header. I don't know why. Unit tests still pass. Code Committed pending a peer flogging to take it out. I'm filing a bug against the Foundation to advertise that method -- it is obviously *required* if you want to build a bridge that doesn't leak and doesn't produce lots of stoopid warning messages. Now to clean up some of the unit tests that are currently failing because of other fixes that have been applied recently.... b.bum |