I just noticed this while monitoring the browser memory usage while it was hosting a Silverlight image control. It appears that if you create a simple image control, with a modest size of 127KB, the total memory used by the browser increases by about 20MB.
Let me describe the scenario and perhaps you can try it out for yourself.
Create a simple Silverlight application and place a TextBlock on the page. The XAML should be similar to the listing below.
1 <UserControl x:Class="ImageControlMemory.Page"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Width="400" Height="300">
5 <Grid x:Name="LayoutRoot" Background="White">
6 <TextBlock Text="Is the silverlight image control a memory hog?" />
7 </Grid>
8 </UserControl>
Next bring up a tool that will allow you to monitor memory usage at the process level. I use SysInternals Process Explorer. Navigate to some site (I choose Google). Go back to the Process Explorer tool, find the Browser process and double click it. This will bring up the Process Properties window from which you can see the memory usage of the browser. You should see something similar to the figure below.
Browser memory usage when visiting Google.com.
Note that the memory usage for the browser (FireFox) is about 27MB.
Now navigate to the page that hosts the above Silverlight control. The memory usage in the Process Explorer should have increased by about 13MB. I assume that is a reasonable amount to host Silverlight. The memory usage when hosting this simple Silverlight control is shown in the figure below.
Browser memory usage with Silvelight control containing a text block control.
Now lets add an Image control to the XAML. But before you add the Image control you will need an image. The image I used is about 127KB. Go ahead find an image of similar size, add it to the Silverlight project and make sure it's Build Action is set to Resource. Next add the image control to the XAML. Your new XAML should be similar to the listing below.
1 <UserControl x:Class="ImageControlMemory.Page"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Width="400" Height="300">
5 <Grid x:Name="LayoutRoot" Background="White">
6 <TextBlock Text="Is the silverlight image control a memory hog?" />
7 <Image Source="image.jpg" />
8 </Grid>
9 </UserControl>
Start a new instance of the browser making sure there are no other instances running. Navigate to the google site and then navigate to the page that hosts the second Silverlight control. Now take a look at the browser's memory usage. It should be close to 60MB! The Process Explorer display is shown below.
Browser memory usage with Silvelight control containing an image control.
Let's recap when the browser is displaying a simple site such as google.com the memory usage is about 27MB. Next if we navigate to a site with a Silverlight control containing one TextBlock control the memory usage is about 40MB. Lastly, if we navigate to a site with a Silverlight control containing a TextBlock and an Image control (with a size of 127KB) then the size is around 60MB.
20MB just to display an image of size 127KB. What's going on?