Hm it looks like I have found a very pitfall to leak memory
when using -[NSThread detachNewThreadSelector:toTarget:withObject:]

Suppose you have somewhere

   [NSThread detachNewTheadSelector....
             ...
             withObject: myInterestingObject];

Now when the thread finished, myInterestingObject
is send a release message.    
This release message is send WITHOUT having an autoreleasepool in place.
So if the dealloc method of myInterestingObject, triggers
an autorelease on another object this other object will leak.

Is this expected behaviour?  Because if it is you have 
to ensure in all your code that no dealloc triggers indirectly an autorelease.
This  is a big task, because just about any string manipulation creates
autoreleased objects.

Wim Oudshoorn.


_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to