Swift 1.2 crashes in release mode - ios

When an app is built with -O (fastest) setting , crashes occur very quickly at seemingly random places.
Occurs in latest beta as well as final.
How would one track those down?
Tried allocations instrument with NSZombie detection enabled.
Tried crashlytics and/or device crash reports but they are similarliy cryptic to me.
Started to put debug messages in the code, trying to find out where it sometimes hits.
I read here and on the apple dev formus that it could be related to core data fetches, to upper/lower case String operations, Array conversions from/to NSArray, etc.
All I am getting currently is:
malloc: *** error for object 0x174e3439c: Invalid pointer dequeued from free list
*** set a breakpoint in malloc_error_break to debug
Turning off optimizations in release mode with -Onone seems to fix the problem(s) I am experiencing with my code.
Any pointers would be highly appreciated.

Related

Xcode 9 crashing when running split view app on iPhone

After working just fine on both iPhone and iPad for a month, my Xcode 9 app has consistently started crashing causing me the following fatal problem: When I build & run it on an iPhone (simulator or device) Xcode completes loading the app and then crashes too fast for me to copy/paste the error from the debugger. When I run on iPad it works fine leading me to believe this is a result of something related to the split master/detail view.
If I use either an exception breakpoint or an "all C++ exceptions" it will stop at the AppDelegate class and crash if I hit play. If I use only an "all Objective-C exceptions" it will crash as before.
In the debug view hierarchy I get the following errors as well:
Error: Unable to capture view hierarchy.
Details: Log Title: Data source expression execution failure.
Log Details: error evaluating expression “(id)
[[(Class)objc_getClass("DBGTargetHub") sharedHub]
performRequestWithRequestInBase64:#"...
Log Method: -[DBGDataSourceConnectionLibViewDebugger
_executeLLDBExpression:forRequest:onPotentialThread:iteration:]
_block_invoke_2
Method: -[DBGViewDebugger updateDebugHierarchy]_block_invoke_2
I have tested other apps and this issue is unique to the app I am working on. Any ideas or debugging tips for how to proceed? I might just have to redo this whole project again if I can't even find the root cause of this! Appreciate any help.
Quick solution: Reset Simulator Device
I managed to resolve the above issue thanks to some serious digging. First, to resolve the instantaneous crash problem, I set a breakpoint at every line in the app delegate. That allowed me to narrow the error to a memory handling problem. From there I started running the code on one of each device available, and realized the crash only occurred on devices I had used earlier in development. Resetting those devices solved the problem.
The core issue here is that when you clean/rebuild your xcode program, it updates the app code on the device, but not necessarily the data model information. So when I changed my data model by including new data and renaming old data it was not properly updated.

Parse iOS framework causing memory crashes

I've used Xcode's zombie debugger and managed to find this flag upon launch:
This crashed the app, and re-recording from Instruments caused the same result. Relaunching the app from the device made the app launch without a crash and subsequent launches from Instruments resulted in normal operation without flags or crashes.
Can anyone make sense of this or advise? I'm getting a number of "heap corruption" crashes in production. The reports are limited to a handful of users, but I'm afraid that number is growing.
It looks like the Parse SDK's latest release notes (1.15.1) addresses this:
-Adds polygonal queries
-Fixes memory leaks related with PFCommandCache
But my crash reports are coming from builds with this SDK version.
The Parse team has responded saying that a fix for this is coming to a new SDK release soon. :)

Intermittent Xamarin.iOS crash with no exception thrown

I have created a Xamarin.Forms barcode scanning app with Android and iOS projects. The Android build appears to run fine, but the iOS build occasionally crashes and I am struggling to pin down the cause, as no crash log is produced and no exception is reported in the application output.
Under heavy load (non-stop barcode scanning) the app crashes after typically 200 or 300 barcodes have been scanned.
I am puzzled how such a crash can occur, leaving absolutely no evidence of its cause. Is there somewhere else I should be looking for the evidence, apart from within Xcode's Devices window? Shouldn't I expect an exception to be reported in the application output, while debugging?
I have implemented logging handlers for AppDomain.CurrentDomain.UnhandledException and TaskScheduler.UnobservedTaskException but they don't appear to be called. Is there some other way I can instrument my code to trap the cause of this crash?
Many thanks for your advice,
Tim
To get some output I always hit the continue button in visual studio debugger. The application stops, and for some reason I can see an exception in the output. Hope this helps.

“JetsamEvent-2015-03-18-151504.ips” files are generated for crashes instead of .crash files

IN iOS 8.2 Device, my application got crashed,So to see the crash logs i connected my device to Mac (Xcode->devices->Device logs)
.There were no crash(.Crash) files generated instead “JetsamEvent-2015-03-18-151504.ips” files were generated which were of no use.And i am also using PLCrashReporter framework to collect crashes , but it is also not helpful in finding these crash files.Do anyone know why the crash file was not generated for my app crash?
Anyone have face this issue.
Thank you.
JetsamEvent log is so called Low Memory Report.
So, it is highly possible that your App was killed by system due to memory shortage.
References
- My app crashes and closes down and there is very little information as to why
- Understanding Low Memory Reports (*a little bit outdated)

iOS App crashes / Xcode shows no backtrace (Paused)

I'm trying to debug a crash (likely memory related) but whenever the app crashes while debugging on iPad device Xcode (4.2) shows Paused with no backtrace for any thread (GDB). Switching to LLDB provides even less -- the app crashes, console shows nothing and Xcode ends debugging.
The crash only occurs after intense use and is likely related to insufficient memory.
I can't find any info related to the crash though. Anyone else experienced this behavior?
Have you set the exception breakpoint?
got to breakpoint editor pane
click on the [+] in the bottom left corner of the pane
choose add exception breakpoint
Now you should see a stacktrace if an exception occurs.
"Appearing after intensive use" indicates to excessive memory usage and memory leaks, and not that not enough memory is available.
Run the application on your device with instruments running and turn on the leaks module to find where you are not freeing allocated memory.

Resources