Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am having a horrible time with the automatic image caching by WP7 platform.

I made a very simple app (I mean real simple). They have 2 images already added in solution as content of pix dimension 1280 x 2000 Here is XAML
XML
<Grid x:Name="LayoutRoot" removed="Transparent" ManipulationCompleted="ImageHolder_ManipulationCompleted">
        <Image x:Name="ImageHolder" />
        <TextBlock x:Name="MemoryUsage" />
</Grid>

My .cs
C#
ImageHolder.Source = null;
      if (i % 2 == 0)
           ImageHolder.Source = new BitmapImage(new Uri("image002.jpg", UriKind.Relative));
      else
           ImageHolder.Source = new BitmapImage(new Uri("image001.jpg", UriKind.Relative));
            i++;

            MemoryUsage.Text = "Device Total Memory = " + (long)DeviceExtendedProperties.GetValue("DeviceTotalMemory") / (1024 * 1024)
                + "\nCurrent Memory Usage = " + (long)DeviceExtendedProperties.GetValue("ApplicationCurrentMemoryUsage") / (1024 * 1024)
                + "\nPeak Memory Usage = " + (long)DeviceExtendedProperties.GetValue("ApplicationPeakMemoryUsage") / (1024 * 1024);

Memory usage is very high is equal to the 2 images in raw bitmap size, though there should only be one such instance. Please help, I am in dire need.
Posted
Updated 16-Nov-12 23:00pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900