Re: [Pyobjc-dev] Re: [Pyobjc-checkins] CVS: pyobjc/Modules/objc objc_util.h,1.24,1.25 objc_util.m,1.
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-04-07 17:26:40
|
On Apr 7, 2004, at 1:17 PM, Ronald Oussoren wrote: > > On 7-apr-04, at 19:11, Bob Ippolito wrote: >> >> Because creating one is harmless, and if you don't create one you >> leak memory. > > Creating one is not harmless if you never release it, you still leak > memory without any message about this. > > We currently leak 1 NSInvocation while creating the NSAutoreleasePool > in a new thread, and this is logged. Because it is logged I get nagged > anytime I run the unittests, which makes it more likely that this > problem will be fixed. The NSAutoreleasePool goes away whenever the threadstate dict does, and that's up to Python to decide. My best guess is that it goes away as soon as you call PyGILState_Release, but I have not yet looked at the implementation. +[NSThread detachNewThreadSelector:toTarget:withObject:] leaks memory without these autorelease pools because "primitive" types such as NSString will cause an autorelease to happen while creating a python shadow type (like pyobjc_unicode) before any code gets executed in the new thread. -bob |