0

I have been trying to debug some issues in my app based on the logs that I see in Crashlytics. I am frequently coming across crashes with logs.

libswiftCore.dylib -> swift_unknownRetain_n + 44

libswiftCore.dylib -> swift_unknownRelease + 24

The exception thrown was EXC_BAD_ACCESS KERN_INVALID_ADDRESS in both of these cases.

I mostly see them when using blocks. I understand that these are segmentation faults, but shouldn't ARC handle the memory management gracefully to prevent these errors? Or am I missing some key point?

jarora
  • 5,384
  • 2
  • 34
  • 46
  • [Check this link already posted by other user **http://stackoverflow.com/questions/35378756/dyld-library-not-loaded-rpath-libswiftcore-dylib**](http://stackoverflow.com/questions/35378756/dyld-library-not-loaded-rpath-libswiftcore-dylib) – Sharda Prasad May 10 '17 at 05:33

1 Answers1

0

This crash mainly due to a memory leak. When any variable or object is trying to access restricted memory this crash occurs. Sometimes without notice, we will try to access the released object(In this situation also possibly crash may occur). Yes, in most cases ARC will take care of memory. You don't need to worry. Please check, if you are accessing restricted memory.

Issue with Blocks: You identified a key thing here. Using of the blocks. Yes there are chaces of getting this error when using blocks. If you use a block with a strong reference to outer object which also has a strong reference to this block, there will be a memory leak. when your block try to access another object (the 3rd role), you may be thinking there are all in the same scope and alive in the same time. but, unfortunately, the 3rd role may be deallocated. (the reference to 3rd role must be weak)

Sivajee Battina
  • 4,124
  • 2
  • 22
  • 45