Connecting Tech Pros Worldwide Help | Site Map

VB.NET Memory Leaks

Sonu
Guest
 
Posts: n/a
#1: Sep 5 '08
Hello -

I have the following code in my vb.net app and when it runs, the memory
usage at the Windows Task Manager keeps increasing for the application and
stops after a while. I'm using some bitmaps and sound in the program.

How would I stop the size thing to increase! I went to these link already
but I cannot fix this issue.
http://msdn.microsoft.com/en-us/libr...isposable.aspx
http://www.java2s.com/Code/VB/Develo...agecollect.htm

Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
GC.SuppressFinalize(Me)
End If
MyBase.Dispose(disposing)
End Sub

Protected Overrides Sub Finalize()
MyBase.Finalize()
Dispose()
End Sub

Any help would be greatly apprecited with a sample code.

Thanks,
Sonu




Anthony Jones
Guest
 
Posts: n/a
#2: Sep 5 '08

re: VB.NET Memory Leaks


"Sonu" <replymeonly@hotmail.comwrote in message
news:O2KVd$3DJHA.1832@TK2MSFTNGP03.phx.gbl...
Quote:
Hello -
>
I have the following code in my vb.net app and when it runs, the memory
usage at the Windows Task Manager keeps increasing for the application and
stops after a while. I'm using some bitmaps and sound in the program.
>
How would I stop the size thing to increase! I went to these link already
but I cannot fix this issue.
http://msdn.microsoft.com/en-us/libr...isposable.aspx
http://www.java2s.com/Code/VB/Develo...agecollect.htm
>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
GC.SuppressFinalize(Me)
End If
MyBase.Dispose(disposing)
End Sub
>
Protected Overrides Sub Finalize()
MyBase.Finalize()
Dispose()
End Sub
>
Any help would be greatly apprecited with a sample code.
>

..NET does not free memory urgently. It uses a garbage collector which may
choose to free up memory when it sees fit. You cannot conclude there is a
memory leak with what you have observed. If there were the memory usage
wouldn't plateua like it is.

--
Anthony Jones - MVP ASP/ASP.NET

Miro
Guest
 
Posts: n/a
#3: Sep 5 '08

re: VB.NET Memory Leaks


Next you will find that if you minimize your application maximize it you
will have a different memory status.
But dont bother trying to minimize your app all the time. - it wont actaully
do anything much.

The Taskbar memory usuage actaully displays a misrepresented memory usage.

Here is a semi-good explination:
http://www.itwriting.com/dotnetmem.php



"Sonu" <replymeonly@hotmail.comwrote in message
news:O2KVd$3DJHA.1832@TK2MSFTNGP03.phx.gbl...
Quote:
Hello -
>
I have the following code in my vb.net app and when it runs, the memory
usage at the Windows Task Manager keeps increasing for the application and
stops after a while. I'm using some bitmaps and sound in the program.
>
How would I stop the size thing to increase! I went to these link already
but I cannot fix this issue.
http://msdn.microsoft.com/en-us/libr...isposable.aspx
http://www.java2s.com/Code/VB/Develo...agecollect.htm
>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
GC.SuppressFinalize(Me)
End If
MyBase.Dispose(disposing)
End Sub
>
Protected Overrides Sub Finalize()
MyBase.Finalize()
Dispose()
End Sub
>
Any help would be greatly apprecited with a sample code.
>
Thanks,
Sonu
>
>
>
>
Brian Gideon
Guest
 
Posts: n/a
#4: Sep 8 '08

re: VB.NET Memory Leaks


On Sep 5, 12:50*pm, "Sonu" <replymeo...@hotmail.comwrote:
Quote:
Hello -
>
I have the following code in my vb.net app and when it runs, the memory
usage at the Windows Task Manager keeps increasing for the application and
stops after a while. I'm using some bitmaps and sound in the program.
>
How would I stop the size thing to increase! I went to these link already
but I cannot fix this issue.http://msdn.microsoft.com/en-us/libr...agecollect.htm
>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
* * * * If disposing AndAlso components IsNot Nothing Then
* * * * * * components.Dispose()
* * * * * * GC.SuppressFinalize(Me)
* * * * End If
MyBase.Dispose(disposing)
End Sub
>
Protected Overrides Sub Finalize()
* * * * MyBase.Finalize()
* * * * Dispose()
End Sub
>
Any help would be greatly apprecited with a sample code.
>
Thanks,
Sonu
There may not even be a problem. You said that memory usage as it
appears in Task Manager stops at some point. That's a pretty good
indication that your application is not leaking memory.
Closed Thread