GC not cleaing up my app !
Posted on 2006-07-10
I'm running a test trying to resolve a few issues in my application. Basically I've got a memory leak and have created the below test.
But I can't understand what's going on. In the small application below, I add multiple (3mb) picturebox's to a panel on a form.
I watch the memory increase as I add them.
But when I remove them, why doesn't the memory come down ?
Is there a way of getting the GC to clean this up ? Or some other way perhaps ?
I really don't understand the cleanup operation for .net ....
'//-- CODE ---------------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Private Sub LoadImage()
Dim PictureBox As New PictureBox
Static Counter As Integer = 0
Counter += 1
.Parent = Panel1
.Load("c:\test.bmp") '//-- A 3mb bimap ...
.Top = 10 * Counter
.Left = 10 * Counter
.Width = 100
.Height = 100
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click