0

I am currently working on an app, which loads and uploads a few pictures from the isolated storage and from a Webservice (RESTFul) via Streams. The pictures themselves aren't that big (500kb - 2MB per Stream). But after a few, always different amount of operations (e.q. displaying or downloading a list of pictures) I get the outOfMemory Exception. I also made sure, that in every case the streams are correctly closed.

using (MemoryTributary mem = new MemoryTributary(imageBytes))
                {
                    bitmapImage.SetSource(mem);
                    bitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
                    mem.Close();
                }

In this special case we also used the downloadable class MemoryTributary which should be able to handle big data better than memoryStreams.
http://www.codeproject.com/Articles/348590/A-replacement-for-MemoryStream
Somehow I think the used resources aren't freed, although the Streams are closed, after using them.

Anon
  • 23
  • 3
  • Its probably a problem with the bitmapImage handling. Check out http://stackoverflow.com/questions/18127027/memory-consumption-of-bitmapimage-image-control-in-windows-phone-8 – Faris Zacina Feb 11 '15 at 14:33
  • Thanks for your fast answer. We now tried tried that with that given method, and also set all the other objects to null. Then we used Collect. Still the same problem... – Anon Feb 12 '15 at 10:08
  • You should definitely do a memory profiling, and share the results.https://msdn.microsoft.com/en-us/library/windows/apps/jj215908(v=vs.105).aspx – Faris Zacina Feb 12 '15 at 10:17

1 Answers1

0

Ok, we got it now. The UriSource has also to be set null. Also the Source of the XAML Object has to be updated after setting null, because otherwise it seeems to keep the picture, even though the Source was set to null.

Anon
  • 23
  • 3