I have created a simple wp7 application which contains 2 pages both with a button and an image on it(and 2 pointless radio buttons).:
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<RadioButton Content="RadioButton" Height="80" Name="radioButton1" VerticalAlignment="Top" Margin="0,0,268,0" />
<RadioButton Content="RadioButton" Height="80" HorizontalAlignment="Left" Margin="231,0,0,0" Name="radioButton2" VerticalAlignment="Top" Width="204" />
<Button Content="Button" Height="97" HorizontalAlignment="Left" Margin="137,510,0,0" Name="button1" VerticalAlignment="Top" Width="331" Click="button1_Click"/>
<Image Height="418" HorizontalAlignment="Left" Margin="12,86,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="444" Source="http://brucew.files.wordpress.com/2011/10/stones-some-girls.jpg"/>
</Grid>
And when I navigate back and forth the memory consumption increases up to 30-35.
I’m navigating back with the Back button all the time .
Now I’m afraid that a more complex application with image selector, bingmaps and about 10 other pages will reach the 90 megs barrier pretty easy.
So my question is why is this happening with my test application, is this something I should be concerned about?
Each time you navigate to the second page a new instance is created. The first page will only have a single instance as this is the app entry point.
After you navigate back from the second page that instance is then orphaned and hence eligible for garbage collection. The instance will not be collected immediately, however, instead it will be freed the next time a garbage collection runs (or maybe be on a subsequent run, depending on the memory usage of your app).
I think you will find that the memory usage won’t increase until you have a lot of objects that are actually still in use. The usage you are seeing here is due to a lot of objects whose memory can be reclaimed if needed.