dotnet / dotnet/android-libraries
Memory leak when Xamarin.AndroidX.ConstraintLayout package is installed in source
- Dominant language
- C#
- Stars
- 317
- Forks
- 73
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 17
Description
### Android application type
Android for .NET (net6.0-android, etc.)
### Affected platform version
VS 17.11.2 dotnet 7.0 and dotnet 8.0
### Description
Upon installing Xamarin.AndroidX.ConstraintLayout in the application's source code, a memory leak related to ReportFragment from the androidx.lifecycle library is observed when navigating to a new activity and subsequently returning to the previous activity. This issue was replicated in a new .NET Android solution where only Xamarin.AndroidX.ConstraintLayout was installed. The memory leak was detected using the Android Studio profiler after navigating back to the previous activity. An attachment has been provided for reference.

### Steps to Reproduce
1. Begin by creating a new .NET Android project.
2. Within the main activity page, add a button to facilitate the creation of a new activity.
3. Implement functionality to navigate to the new activity upon clicking the button.
4. Enable navigation back to the previous page by pressing the back button.
5. Repeat this process multiple times.
6. Capture a heap dump using the Android Studio profiler to identify any memory leaks.
7. After iterating the process x times, you should be able to identify x instances of memory leaks.
### Did you find any workaround?
_No response_
### Relevant log output
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.