KCOrderedAccessorFix icon indicating copy to clipboard operation
KCOrderedAccessorFix copied to clipboard

Fixed memleaks

Open StyxUA opened this issue 11 years ago • 7 comments

StyxUA avatar Mar 29 '13 03:03 StyxUA

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.

CFKevinRef avatar Apr 02 '13 14:04 CFKevinRef

In manual reference counting. As you can see, I didn't use release so this patch will work for both ARC and MRC.

StyxUA avatar Apr 02 '13 17:04 StyxUA

Ah, excuse me, I got your point. Let me fix this part.

StyxUA avatar Apr 05 '13 05:04 StyxUA

For an older non-ARC project, I addressed this memory leak issue by turning on ARC just for NSManagedObjectModel+KCOrderedAccessorFix.m

MarkCSmith avatar May 22 '13 20:05 MarkCSmith

Thanks for the input, guys. I've suggested the same solution as @MarkCSmith in the README as it doesn't require any code changes.

CFKevinRef avatar Jul 22 '13 14:07 CFKevinRef

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.

StyxUA avatar Jul 22 '13 14:07 StyxUA

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.

CFKevinRef avatar Jul 22 '13 14:07 CFKevinRef