I m using ByteArrayToImageConverter to convert byte array i m getting from SQL server databse , the converter as below
public class ByteArrayToImageConverter : IValueConverter
{
public ImageSource retSource;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
// ImageSource retSource = null;
if (value != null)
{
byte[] imageAsBytes = (byte[])value;
// byte[] decodedByteArray = System.Convert.FromBase64String(Encoding.UTF8.GetString(imageAsBytes, 0, imageAsBytes.Length));
// var stream = new MemoryStream(decodedByteArray);
retSource = ImageSource.FromStream(() => new MemoryStream(imageAsBytes));
}
return retSource;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
//return null;
throw new NotImplementedException();
}
my problem when i show all the images in the xaml list view ( bind with my model) i m having memeory leaks , every time i open the list view the memory is growing gradually , Whast is the solution to reduce the memeor leaking issue with the converter and list view ( by the way i m using CachingStrategy="RecycleElement" but it dosent reduce the memory leak. please if anyone across this type of issue please let me know.
Thank you inadvance for your support.
Pan