I
Imogen
Guest
I have found that VB.net 's memory handling is very erratic at best.
Problem:
I built a small app in VB6 that pings a server periodically for information. The app uses approx 4500kb in memory. I built a similar app in .Net and it uses 14000kb! and as the program is working it gets larger...and larger.
Strange I thought, I must be allowing objects to live without disposing of the properly, I then went through all my code killing everything that wasnt nailed down. Still the same.
After a couple of days trying to get the program to conform, I noticed that if I minimised the main window to the task bar then set its state to normal again the memory usage would promply go down to 3000kb. As the program was working the memory usage would rise again, so I would perform the minimize...maximize (normal) trick again and yes...it went back to 3000k again.
At this point I tried playing around with the Garbage collector, fearing that it wasnt working properly, but that had no effect.
So in a nutshell I have a program that starts off using 14000kb (9500kb more than its VB6 equivilent) of memory until I minimize then maximize (normal) its main form, then the memory usage goes down by 11000kb!
The program runs for long periods (weeks/months) and the only way to stop it using vast amounts of memory is to periodically make the app automatically minimize then maximize!!
Now to me this seems rather odd! has anyone else noticed this?
Is this a bug?
Does anyone know a fix??
Thanks
Imogen
PS I have built the final exe's in release mode etc....
Problem:
I built a small app in VB6 that pings a server periodically for information. The app uses approx 4500kb in memory. I built a similar app in .Net and it uses 14000kb! and as the program is working it gets larger...and larger.
Strange I thought, I must be allowing objects to live without disposing of the properly, I then went through all my code killing everything that wasnt nailed down. Still the same.
After a couple of days trying to get the program to conform, I noticed that if I minimised the main window to the task bar then set its state to normal again the memory usage would promply go down to 3000kb. As the program was working the memory usage would rise again, so I would perform the minimize...maximize (normal) trick again and yes...it went back to 3000k again.
At this point I tried playing around with the Garbage collector, fearing that it wasnt working properly, but that had no effect.
So in a nutshell I have a program that starts off using 14000kb (9500kb more than its VB6 equivilent) of memory until I minimize then maximize (normal) its main form, then the memory usage goes down by 11000kb!
The program runs for long periods (weeks/months) and the only way to stop it using vast amounts of memory is to periodically make the app automatically minimize then maximize!!
Now to me this seems rather odd! has anyone else noticed this?
Is this a bug?
Does anyone know a fix??
Thanks
Imogen
PS I have built the final exe's in release mode etc....