iOS Out-of-memory reports


#1

The only thing blocking me from switching our iOS project to Sentry from Crashlytics is the lack of OOM reporting.

This has been discussed before, and the answer is impossible, but Crashlytics does it, so the question is “how?”

The answer is here: https://docs.fabric.io/apple/crashlytics/OOMs.html

In short, they continuously track activity while the app is open. If the app is launched in a state where it was previously not crashing for a different reason, it’s considered an OOM. Obviously there are some cases that might cause false positives, like iOS itself crashing. But reporting OOMs can make a huge difference in tracking stability.

I’m thinking of attempting to implement this. Any related experiences you can share, or ideas?


#2

Since version 4.2.0 we should support this.
At least best effort ^^

Hope this helps


#3

Excellent! It looks like this can be called from AppDelegate.didReceiveMemoryWarning. If a memory warning is received but the application is able to free up memory, will any subsequent crash be reported as an OOM?

(The wording of that documentation isn’t entirely clear. The second paragraph says “In case your application receives a memory pressure notification, we will store an event to disk”. But I’m pretty sure it’s supposed to be joined with the first sentence so it says “By calling this function when your application receives a memory pressure notification, we will store an event to disk…”. I think it could use a little more clarity in its phrasing. Something like “Call this function when the application receives a memory warning. When you call this function, we will store an event to disk…”)


#4

Thanks for the feedback, I made it more clear how this function works in this PR.