Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Memory Leak

$
0
0

Hi All,

I have this code using James' Media Plugin

MemoryStream ms = new MemoryStream();
                file.GetStream().CopyTo(ms);
                imageToUpload.Add(ms.ToArray());
                imgSourceList.Add(new ImageToSet { imageData = ImageSource.FromStream(() => new MemoryStream(ms.ToArray())) });

                Counter++;

                if (!submitForm.IsEnabled) submitForm.IsEnabled = true;
                file.Dispose();
                ms.Dispose();

There seems to be a memory leak in the app because after a lot of photos have been taken its crashing, this is the only possible place it could be coming from, Is it because of this line??

imgSourceList.Add(new ImageToSet { imageData = ImageSource.FromStream(() => new MemoryStream(ms.ToArray())) });

Thanks in advance


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>