Fix memory leak issue in SentryFlutterPlugin#1588
Conversation
I fixed the memory leak issue in SentryFlutterPlugin by removing the anonymous inner class that was holding a reference to the external SentryFlutterPlugin object, which was causing a memory leak problem with the MethodChannel object.
We are currently adding tests #1587 |
|
@linkaipeng thanks for the PR. I'm not sure the suggested changes will have any effect, the leak seems to be in https://github.com/getsentry/sentry-java/blob/549cbb4657b9dea1048c4882e79504e87d6acc4f/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java#L26 (based on the SS) The changes with the Can you elaborate on what exactly is causing this, which line, etc? @romtsn or @markushi can chime in as well since they own this part of the code. |
|
What is |
|
Hm, found this, looks very similar ryanheise/audio_session#12. Should we nullify the |
@marandaneto Thank you for your reply. The reason is that the The approach I took was to completely decouple the After modification: Another way to modify is to make the |
|
Oh I see, that makes sense @linkaipeng thanks for the explanation. |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #1588 +/- ##
==========================================
+ Coverage 88.44% 88.68% +0.23%
==========================================
Files 132 124 -8
Lines 4274 3940 -334
==========================================
- Hits 3780 3494 -286
+ Misses 494 446 -48 ☔ View full report in Codecov by Sentry. |
Update changelog getsentry#1588
Thank you. The changelog has been committed. |
the lining issues:
|
Fix some lining issues for SentryFlutterPlugin.
Fixed. |


I fixed the memory leak issue in SentryFlutterPlugin by removing the anonymous inner class that was holding a reference to the external SentryFlutterPlugin object, which was causing a memory leak problem with the MethodChannel object.
📜 Description
💡 Motivation and Context
To reproduce the steps:
💚 How did you test it?
Since the SentryFlutterPlugin does not have unit test code, I repeated the steps mentioned above after making the modifications and confirmed that the issue has been fixed.
📝 Checklist
sendDefaultPiiis enabled🔮 Next steps