From: Panayotis K. <pan...@pa...> - 2010-03-25 17:46:50
|
On 25 Μαρ 2010, at 7:18 μ.μ., Joshua Melcon wrote: > Yes it is necssacry, though in some cases it may be possible to avoid it. > > Basically, if you don't null them out after release, other code paths *may* try to release them again (which would be bad). In some cases, the nulling out isn't necessary -- this is one of the optimizations I intend to add in the future. > > Additionally, consider that setting a register to [NsNull null] is in general going to be a great deal more efficient than adding an object to an auto release pool. So even with unnecessary nulling, we are still faster than autorelease. We will be even faster in the future when I trim out some of this extra stuff.. Of course! I really respect this effort. Still, I think I found a bug :( ------------------------------------ Here is a small example, I was able to make. Consider adding this code to applicationDidFinishLaunching (in java) UIView view = new UIView(); float z = view.getFrame().size.width; This produces (among others) the following code _r2.o = [((org_xmlvm_iphone_UIView*) _r0.o) getFrame__]; _rtmp.o = _r2.o; _r2.o = ((org_xmlvm_iphone_CGRect*) _r2.o)->size_org_xmlvm_iphone_CGSize; [_rtmp.o release]; _rtmp.o = [NSNull null]; [_r2.o retain]; This retain message breaks the code. Actually I believe it is something with the _rtmp.o variable, which was released and just later on retained (since _rtmp.o = _r2.o ) |