Skip to content

Conversation

tustanivsky
Copy link
Collaborator

@tustanivsky tustanivsky commented Sep 26, 2025

This PR adds caching of Java class references for Android to avoid intermittent crashes when creating FSentryJavaObjectWrapper objects (e.g. during intensive logging from multiple threads when Unreal SDK could instantiate large number of breadcrumb wrappers).

Additionally, it fixes memory leak during Sentry level conversion from Java to C++ (global ref was obtained but never freed):

jclass levelEnumClass = AndroidJavaEnv::FindJavaClassGlobalRef("io/sentry/SentryLevel");

Suggested changes should also improve overall performance by removing repeated JNI class lookups (mentioned here).

Closes #848

@tustanivsky tustanivsky changed the title Fix crash when obtaining jclass references on Android Fix Android crash when logging from multiple threads Sep 26, 2025
@tustanivsky tustanivsky marked this pull request as ready for review September 26, 2025 10:22
@tustanivsky tustanivsky merged commit 767fb33 into main Sep 26, 2025
33 checks passed
@tustanivsky tustanivsky deleted the fix/android-jclass-cache branch September 26, 2025 18:02
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.

Crash inside FSentryJavaObjectWrapper when Unreal logging

3 participants