Ok, I think that is what I am doing.
Say, from from1,
Code on button1
dim form2 as new form2
dim form3 as new form3
form2.showdialog()
form3.showdialog()
On form2, when it closes, I run
dispose()
Then this will auto start form3
When form3 closes, I run
dispose()
This takes me back to form1. Just how I want it. This process will happen
multipule times. From from1-> Form2 -> form3 back to form1. But watching the
memory in
task manager on this process, the memory keeps going up each time.
Is dispose() the correct way to remove each form?
> Ok, I think that is what I am doing.
>
> Say, from from1,
> Code on button1
dim frm2 as new form2
frm2.showdialog()
frm2.dispose
dim frm3 as new form3
frm3.showdialog()
frm3.dispose
This is a normal for modal forms, you was confusing me. If you want to hide
form1 in the maintime you can even do me.visible = fals and me.visible =
true (me is the instanced object from the class)
> This takes me back to form1. Just how I want it. This process will happen
> multipule times. From from1-> Form2 -> form3 back to form1. But watching
[quoted text clipped - 3 lines]
>
> Is dispose() the correct way to remove each form?
Dispose does not remove memory. The memory is removed by the Garbage
Collector. That runs at the moment that it is efficient to run. Watching the
taskmanager gives by the way only a kind of avarage result.
The modal form is one of the exceptions where it is *useful* to use the
dispose.
I hope this helps,
Cor
Stingray5678 - 27 Jun 2005 21:02 GMT
Well, I am still getting the same results.
Running the code below:
dim frm2 as new form2
frm2.showdialog()
frm2.dispose
dim frm3 as new form3
frm3.showdialog()
frm3.dispose
CG.Collect()
If you keep clicking the buttons.... Load Form2, close, load form3 close &
Repeat
the memory in the task manager keeps going up. Even if it's not that
accurate, it still goes up.
If you let it sit there a little while, you can see the GC kick in and lower
the memory usage some but never all the way.
Going from form to form like shown will happen approx 10,000 times before
the app is closed. I am worried about the memory getting out of hand.
Is there a better way to accomplish this same task?
Main Form -> Input Form1 -> Input Form2 (Close Form1 & Form2)
> > Ok, I think that is what I am doing.
> >
[quoted text clipped - 30 lines]
>
> Cor
Cor Ligthert - 27 Jun 2005 21:13 GMT
Stingray,
As I said the taskmanager is not giving the correct figurs
Calling GC cost you performance. I assume you know that.
Have a look at a message from Willy in this newsgroup.
http://groups-beta.google.com/group/microsoft.public.dotnet.general/msg/392a8e93
2c39983d?hl=en
Cor
Stingray5678 - 28 Jun 2005 03:11 GMT
Thanks for your help Cor.
That was a great post by Willy. I was freeking out over nothing :-)
Started to make me worry. I will be testing this in the next few days.
Should be fine after reading Willy's post.
:-)
> Stingray,
>
[quoted text clipped - 7 lines]
>
> Cor