Out of Memory bug in Visual Studio 2010 Visual Basic .Net 4.0?
I have a two Windows Form Program that is a picture database and slide show. The

slide show continuously updates the displayed picturebox without incrementing the

memory used with each new switch of picture. However, I have a second form that

has 50 pictureboxes that are meant to display thumbnails of pictures to be added to the database. As each picturebox of size(57,40) is updated with a small-sized thumbnail(<12K), the memory used  by the IDE rises  to a little over 1GB on my 32bit XP system, from about 660MB before any thumbnail pictureboxes are loaded.

With around 30 of the size(57,40) pictureboxes are loaded from .jpg source files >3MB, the IDE memory use rises to around 2.1GB. (Problem is not easily encountered with .jpg images <=15K and all 50 thumbnails can be used with <1.3 GB mem used).

Problem shows itself with images of average .jpg file size >3MB per HD Canon camera .jpg image are loaded into 30 of the displayed thumbnail pictureboxes and I begin to start to click around selecting pictures displayed and memory used rises quickly and over the 2.3GB memory usage causing Out of Memory crash.

Is this a bug in VB2010 or .NET 4.0 ????

Once all the pictures are displayed as thumbnails, a mouse click on any of the 50 pictureboxes on the panel containing all thumbnails updates  a single large picturebox on the form itself to display the picture in a single picture box with a size(1024,768). When any thumbnail is clicked, the single large Picture box displays it's associated picture from a file, but at the same time, system memory increments about 240KB per click event. Eventually, at around >2.3GB of system memory used, the program crashes with an Out of Memory error.

How can I get the program to recover the memory used by the same picturebox when

it is updated with just another picture?

 

Partial Code below:

' Each Thumbnail has a click event

 

 Private Sub PB49_Click(sender As System.Object, e As System.EventArgs) Handles PB49.Click 'PB49 is a PictureBox max size (57,40) used as a thumbnail display, all 50 are on a panel

 If PB(49) = 1 Then PB(49) = 0 Else PB(49) = 1

'PB(50) is an Integer Array flagging Pictures to add

If PB(49) = 1 Then

   CheckBox49.Checked = True 'Tiny Checkbox on thumbnail

   F$ = ListAddFiles.Items(48)'ListFileBox of FileNames

   PBx1.Image = Image.FromFile(F$)'Gets filename and path and loads image into PictureBox

   PBx1.Visible = True 'Large PictureBox (1024,768)shows Pic F$ located on Form

  Else

   CheckBox49.Checked = False

   PBx1.Image = Nothing

   PBx1.Visible = False

  End If


End Sub

'I am using Visual Studio Ultimate SP1 updated .NET 4.0 on XP PRO 32-Bit SP3 4GB RAM installed
Out of Memory bug in Visual Studio 2010 Visual Basic .Net 4.0?
===

I have a two Windows Form Program that is a picture database and slide show. The

slide show continuously updates the displayed picturebox without incrementing the

memory used with each new switch of picture. However, I have a second form that

has 50 pictureboxes that are meant to display thumbnails of pictures to be added to the database. As each picturebox of size(57,40) is updated with a small-sized thumbnail(<12K), the memory used  by the IDE rises  to a little over 1GB on my 32bit XP system, from about 660MB before any thumbnail pictureboxes are loaded.

With around 30 of the size(57,40) pictureboxes are loaded from .jpg source files >3MB, the IDE memory use rises to around 2.1GB. (Problem is not easily encountered with .jpg images <=15K and all 50 thumbnails can be used with <1.3 GB mem used).

Problem shows itself with images of average .jpg file size >3MB per HD Canon camera .jpg image are loaded into 30 of the displayed thumbnail pictureboxes and I begin to start to click around selecting pictures displayed and memory used rises quickly and over the 2.3GB memory usage causing Out of Memory crash.

Is this a bug in VB2010 or .NET 4.0 ????

Once all the pictures are displayed as thumbnails, a mouse click on any of the 50 pictureboxes on the panel containing all thumbnails updates  a single large picturebox on the form itself to display the picture in a single picture box with a size(1024,768). When any thumbnail is clicked, the single large Picture box displays it's associated picture from a file, but at the same time, system memory increments about 240KB per click event. Eventually, at around >2.3GB of system memory used, the program crashes with an Out of Memory error.

How can I get the program to recover the memory used by the same picturebox when

it is updated with just another picture?

 

Partial Code below:

' Each Thumbnail has a click event

 

 Private Sub PB49_Click(sender As System.Object, e As System.EventArgs) Handles PB49.Click 'PB49 is a PictureBox max size (57,40) used as a thumbnail display, all 50 are on a panel

 If PB(49) = 1 Then PB(49) = 0 Else PB(49) = 1

'PB(50) is an Integer Array flagging Pictures to add

If PB(49) = 1 Then

   CheckBox49.Checked = True 'Tiny Checkbox on thumbnail

   F$ = ListAddFiles.Items(48)'ListFileBox of FileNames

   PBx1.Image = Image.FromFile(F$)'Gets filename and path and loads image into PictureBox

   PBx1.Visible = True 'Large PictureBox (1024,768)shows Pic F$ located on Form

  Else

   CheckBox49.Checked = False

   PBx1.Image = Nothing

   PBx1.Visible = False

  End If


End Sub

'I am using Visual Studio Ultimate SP1 updated .NET 4.0 on XP PRO 32-Bit SP3 4GB RAM installed