Disable App Hang report in low memory conditions
Problem Statement
I have several users that run a 64GB dev machine and still somehow manage to fill up their entire RAM until the OS starts paging - thus appearing as a hang.
I propose to introduce a free memory limit for reporting app hangs.
Set it to a default of lets say 500MB of memory that must be free for the hang to be reported.
Solution Brainstorm
No response
Are you willing to submit a PR?
No response
Hey @eaigner thanks for the suggestion - we'll discuss if we want to add this. In the mean time, you could use beforeSend to filter App Hang events you don't want, like described in our docs.
For example you could do the following:
options.beforeSend = { event in
if (event.exceptions?.first?.type == "App Hanging") {
if let freeMemory = event.context?["device"]?["free_memory"] as? UInt64, freeMemory < 50 * 1024 * 1024 {
return nil
}
}
return event
}
Note, however, that free_memory will contain the actual free memory as reported by the system (and in Sentry) and does not include quickly usable memory such as inactive.
The snippet provided is the solution we suggest. The SDK has no way to detect whether the APP hang is caused by memory swap or a actual problem of the app.