getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
191 stars 50 forks source link

Memory leaks in iOS SentryNativeBridge #1619

Open etnlGD opened 1 month ago

etnlGD commented 1 month ago

Environment

How do you use Sentry? self-hosted

Which version of the SDK? 1.8.0

How did you install the package? (Git-URL, Assetstore) Git-URL

Which version of Unity? 2020.3.11f1

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? iOS

Steps to Reproduce

Debug.Log lots of things

Expected Result

No memory leaks

Actual Result

Memory leak found in the screenshot. @autoreleasepool should be added in every callbacks in the Plugins/iOS/SentryNativeBridge.m

Any logs or screenshots

img_v3_029t_7bff532f-1b5e-4712-91f5-6593eb97f36g

bitsandfoxes commented 1 month ago

Thanks for raising this and providing a solution too!

bitsandfoxes commented 3 days ago

Hey @etnlGD, are you sure you're experiencing a memory leak and those objects aren't just retained longer than expected but end up being released eventually?

etnlGD commented 3 days ago

Hey @etnlGD, are you sure you're experiencing a memory leak and those objects aren't just retained longer than expected but end up being released eventually?

I'm sure it's a memory leak, these objects will never be released until the program exits.