From: Gergely K. <ger...@ma...> - 2009-12-13 17:15:11
|
Hi, I observed, the following pattern in the generated code (in pseudocode): _op1.o = [ref methodCall]; [op1.o autorelease]; However, the Cocoa memory management guide says, that you only need to release a reference, if you own it. It also says that you only own an object, if it was created with init, new or copy, or you have called retain on it. This means that in general if you call a method, you do not own the returned object, so you should not call autorelease on it. Why does this XMLVM the other way around? Is it because of the separate autoreleasepool for each method? It could generate the return sequence like this, and still follow the general rules of Cocoa memory management: in the returning method: [_op1.o retain]; [_pool release]; return [_op1.o autorelease]; in the caller do not call autorelease. Am I missing something? Best Regards, Gergely -- Kis Gergely MattaKis Consulting Email: ger...@ma... Web: http://www.mattakis.com Phone: +36 70 408 1723 |