I am using a popup to show a popup in an android application for xamarin. Every time I open and close a pop-up window, a memory pops up, and this is not remembered. I use the constructor to open a popup. How can we properly manage the memory inside the popup when it is closed.
// call from the parent page
await Navigation.PushPopupAsync(new ImagePopUp(imgSrc));
// ImagePopUp
public ImagePopUp() { InitializeComponent(); var tapgesture = new TapGestureRecognizer(); tapgesture.Tapped += async (sender, e) => Handle_Clicked(sender, e); this.Content.GestureRecognizers.Add(tapgesture); } public ImagePopUp(ImageSource src) : this() { try { PopUpImageHolder.HeightRequest = App.ScreenHeight * 0.8; if (src != null) { PopUpImageHolder.Source = src; } } catch (Exception ex) { Task.Run(async () => await DisplayAlert("Alert", ex.Message, "OK")); }
and close the popup that I'm using
await PopupNavigation.PopAsync();
Image memory is allocated every time I open a popup
source share