KCOrderedAccessorFix
KCOrderedAccessorFix copied to clipboard
Fixed memleaks
Are these leaking in ARC or manual reference counting? I avoided the autoreleasing methods wherever possible. Under ARC, autoreleasing Foundation methods still get dumped into the current autorelease pool instead of going through objc_autoreleaseReturnValue().
Not a huge deal, just wanted to clarify my choices there.
In manual reference counting. As you can see, I didn't use release
so this patch will work for both ARC and MRC.
Ah, excuse me, I got your point. Let me fix this part.
For an older non-ARC project, I addressed this memory leak issue by turning on ARC just for NSManagedObjectModel+KCOrderedAccessorFix.m
Thanks for the input, guys. I've suggested the same solution as @MarkCSmith in the README as it doesn't require any code changes.
You see, this solution couldn't work in some situations. For example, in my situation, I need to compile GC-compatible code. It is required for ScreenSaver bundles for 10.7, so I can't use ARC at all.
Ah thanks, I see. My original implementation in manual ref count used local variables and -release
as I saw a lot of strings being dumped into the autorelease pool. It should be simple to check for the presence of ARC at compile-time and just define them out.