Skip to content

New OOM Handling Options#2384

Merged
lemnik merged 13 commits intonextfrom
PLAT-15492/improve-oom-reporting
Feb 12, 2026
Merged

New OOM Handling Options#2384
lemnik merged 13 commits intonextfrom
PLAT-15492/improve-oom-reporting

Conversation

@lemnik
Copy link
Copy Markdown
Contributor

@lemnik lemnik commented Feb 9, 2026

Goal

Allow more customisation over OutOfMemoryError handling.

Design

OutOfMemoryErrors are a complex case and can sometimes be under reported because our default error handling needs to allocate memory for the Event and all of its data.

This PR introducing a new OutOfMemoryHandler which can either block or augment the default exception handling path before the SDK attempts to process an OutOfMemoryError. The bugsnag-plugin-android-ndk module now includes a specialised path for OutOfMemoryHandler that can be enabled via a new NativeOutOfMemoryPlugin

Changeset

  • Added Client.outOfMemoryHandler (get/set) and Bugsnag.outOfMemoryHandler (get/set)
  • Introduced Throwable.anyCauseMatches to avoid allocating an unrolled cause list when detecting discards and OutOfMemoryErrors
  • Added NativeOutOfMemoryPlugin as new public API in bugsnag-plugin-android-ndk which will redirect OutOfMemoryErrors to the NDK layer for reporting through pre-allocated memory

Testing

New end-to-end tests

@lemnik lemnik requested a review from tomlongridge February 9, 2026 11:49
@lemnik lemnik requested a review from YYChen01988 as a code owner February 9, 2026 11:49
@bugsnagbot
Copy link
Copy Markdown
Collaborator

bugsnagbot commented Feb 9, 2026

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1859.61 1603.07
arm64_v8a 672.0 409.86
armeabi_v7a 610.57 352.52
x86 741.62 483.57
x86_64 712.95 454.9

Generated by 🚫 Danger

tomlongridge
tomlongridge previously approved these changes Feb 10, 2026
Copy link
Copy Markdown
Contributor

@tomlongridge tomlongridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - changelog pending at release

@lemnik lemnik merged commit d0cef6a into next Feb 12, 2026
42 checks passed
@lemnik lemnik deleted the PLAT-15492/improve-oom-reporting branch February 12, 2026 12:01
@lemnik lemnik mentioned this pull request Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants