Skip to content

Conversation

@buenaflor
Copy link
Contributor

@buenaflor buenaflor commented Oct 13, 2025

📜 Description

Part of JNI/FFI refactorings:

💡 Motivation and Context

Partly completes #3204

💚 How did you test it?

Manual, integration tests

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

cursor[bot]

This comment was marked as outdated.

Base automatically changed from enh/ffi-jni-breadcrumbs-sync to main October 23, 2025 13:29
@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Memory Leak in setUser Method

The setUser method creates Objective-C objects (dictionary and cUser) but never releases them. In the Cocoa FFI bindings, objects returned from methods like toNSDictionary() and userWithDictionary() must be explicitly released after use to prevent memory leaks. The method should call .release() on these objects in a finally block or use proper memory management patterns.

Fix in Cursor Fix in Web

@buenaflor
Copy link
Contributor Author

buenaflor commented Oct 23, 2025

The setUser method creates Objective-C objects (dictionary and cUser) but never releases them

Bugbot is wrong here, it will auto-release when the Dart object is garbage collected (only for objc, in JNI you have to manually release)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1248.15 ms 1250.48 ms 2.33 ms
Size 5.53 MiB 6.01 MiB 488.10 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7b21e8b 1256.79 ms 1267.12 ms 10.33 ms
6f47800 1247.52 ms 1259.37 ms 11.85 ms
a10aff4 1241.67 ms 1255.02 ms 13.35 ms
4481076 1256.48 ms 1266.64 ms 10.17 ms
6bcdc99 1257.16 ms 1264.96 ms 7.79 ms
29e8ebe 1260.46 ms 1262.60 ms 2.14 ms
827bf09 1261.86 ms 1276.41 ms 14.55 ms
192b44c 1269.08 ms 1275.52 ms 6.44 ms
54acf91 1257.65 ms 1277.96 ms 20.31 ms
73a3c38 1263.37 ms 1277.90 ms 14.53 ms

App size

Revision Plain With Sentry Diff
7b21e8b 5.53 MiB 6.00 MiB 479.96 KiB
6f47800 7.86 MiB 9.44 MiB 1.58 MiB
a10aff4 5.53 MiB 6.00 MiB 486.71 KiB
4481076 7.86 MiB 9.44 MiB 1.58 MiB
6bcdc99 5.53 MiB 6.00 MiB 479.95 KiB
29e8ebe 5.53 MiB 6.01 MiB 488.12 KiB
827bf09 7.86 MiB 9.44 MiB 1.58 MiB
192b44c 5.53 MiB 5.96 MiB 444.33 KiB
54acf91 20.70 MiB 22.46 MiB 1.75 MiB
73a3c38 7.86 MiB 9.44 MiB 1.58 MiB

Previous results on branch: enh/ffi-jni-set-user

Startup times

Revision Plain With Sentry Diff
7a06bf5 1258.14 ms 1254.44 ms -3.71 ms
773a959 1230.90 ms 1234.00 ms 3.10 ms
0cfd83f 1266.21 ms 1262.47 ms -3.74 ms
e99dc61 1257.67 ms 1263.78 ms 6.10 ms
0319d40 1265.59 ms 1266.53 ms 0.94 ms
5ef5a4a 1268.94 ms 1276.78 ms 7.84 ms
21d97b1 1266.02 ms 1266.84 ms 0.82 ms
a9db6e3 1235.54 ms 1244.40 ms 8.86 ms
fff6d2e 1252.47 ms 1254.47 ms 2.00 ms
bf7b3dc 1240.61 ms 1235.23 ms -5.38 ms

App size

Revision Plain With Sentry Diff
7a06bf5 5.53 MiB 6.00 MiB 486.54 KiB
773a959 5.53 MiB 6.00 MiB 485.62 KiB
0cfd83f 5.53 MiB 6.01 MiB 487.42 KiB
e99dc61 5.53 MiB 6.00 MiB 486.45 KiB
0319d40 5.53 MiB 6.00 MiB 486.54 KiB
5ef5a4a 5.53 MiB 6.00 MiB 486.45 KiB
21d97b1 5.53 MiB 6.00 MiB 486.45 KiB
a9db6e3 5.53 MiB 6.01 MiB 488.10 KiB
fff6d2e 5.53 MiB 6.00 MiB 486.52 KiB
bf7b3dc 5.53 MiB 6.00 MiB 485.63 KiB

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 386.87 ms 392.98 ms 6.10 ms
Size 13.93 MiB 15.06 MiB 1.13 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
cf443d2 464.64 ms 479.04 ms 14.40 ms
2d34233 470.54 ms 558.90 ms 88.36 ms
9b99523 456.91 ms 490.55 ms 33.64 ms
0fb45d0 482.79 ms 554.02 ms 71.23 ms
aeb02f2 373.84 ms 437.00 ms 63.16 ms
eca355d 485.50 ms 569.85 ms 84.35 ms
ad121c0 353.85 ms 358.80 ms 4.95 ms
7cfbbd6 499.69 ms 592.24 ms 92.55 ms
75284dc 512.39 ms 530.87 ms 18.48 ms
fd88186 422.07 ms 469.10 ms 47.03 ms

App size

Revision Plain With Sentry Diff
cf443d2 13.93 MiB 15.00 MiB 1.06 MiB
2d34233 6.54 MiB 7.55 MiB 1.01 MiB
9b99523 6.54 MiB 7.69 MiB 1.15 MiB
0fb45d0 6.54 MiB 7.70 MiB 1.17 MiB
aeb02f2 6.54 MiB 7.69 MiB 1.15 MiB
eca355d 6.54 MiB 7.70 MiB 1.16 MiB
ad121c0 13.93 MiB 15.06 MiB 1.13 MiB
7cfbbd6 6.54 MiB 7.70 MiB 1.17 MiB
75284dc 13.93 MiB 14.93 MiB 1.00 MiB
fd88186 13.93 MiB 15.00 MiB 1.06 MiB

Previous results on branch: enh/ffi-jni-set-user

Startup times

Revision Plain With Sentry Diff
0319d40 486.80 ms 487.94 ms 1.14 ms
21d97b1 640.64 ms 646.81 ms 6.17 ms
5ef5a4a 476.94 ms 474.66 ms -2.28 ms
a9db6e3 373.33 ms 371.28 ms -2.05 ms
e99dc61 380.87 ms 370.87 ms -10.00 ms
0cfd83f 493.25 ms 500.34 ms 7.09 ms
7a06bf5 445.70 ms 440.87 ms -4.83 ms
fff6d2e 498.86 ms 520.20 ms 21.34 ms
bf7b3dc 525.71 ms 529.60 ms 3.89 ms
773a959 406.41 ms 414.14 ms 7.73 ms

App size

Revision Plain With Sentry Diff
0319d40 13.93 MiB 15.06 MiB 1.13 MiB
21d97b1 13.93 MiB 15.06 MiB 1.13 MiB
5ef5a4a 13.93 MiB 15.06 MiB 1.13 MiB
a9db6e3 13.93 MiB 15.06 MiB 1.13 MiB
e99dc61 13.93 MiB 15.06 MiB 1.13 MiB
0cfd83f 13.93 MiB 15.06 MiB 1.13 MiB
7a06bf5 13.93 MiB 15.06 MiB 1.13 MiB
fff6d2e 13.93 MiB 15.06 MiB 1.13 MiB
bf7b3dc 13.93 MiB 15.06 MiB 1.13 MiB
773a959 13.93 MiB 15.06 MiB 1.13 MiB

@buenaflor buenaflor merged commit 393f8ec into main Oct 23, 2025
139 of 141 checks passed
@buenaflor buenaflor deleted the enh/ffi-jni-set-user branch October 23, 2025 15:01
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.

2 participants