Tracking Memory Leaks

  • Thread starter Thread starter Gary Townsend
  • Start date Start date
G

Gary Townsend

I have written a program in vb .net and want to go about trying to track
down a memory leak when i run my program and monitor it using the task
manager in windows 2k my program has a stead progression of memory usage
upwards. I have done all the well behaved things such as using dispose where
i can. So i guess i need to try and track down where approximately i am
using up my memory. Any suggestions?
 
Thank you those were very helpful and pointed out that i do NOT have a
memory leak.

Thanks :)
 
Gary Townsend said:
I have written a program in vb .net and want to go about trying to track
down a memory leak when i run my program and monitor it using the task
manager in windows 2k my program has a stead progression of memory usage
upwards. I have done all the well behaved things such as using dispose
where
i can. So i guess i need to try and track down where approximately i am
using up my memory. Any suggestions?

Allocation Profiler src
<URL:http://www.gotdotnet.com/Community/...mpleGuid=3254325d-a4aa-4bb3-aa86-c72d5104ec74>

CLR Profiler (v2.0)
<URL:http://www.microsoft.com/downloads/...52-D7F4-4AEB-9B7A-94635BEEBDDA&displaylang=en>
 
i have some code that utilizes the system.diagnostic namespace if
you've not solved your problem. You basically a small function at
various points in your program and it gets the current amt of memory
used by your code at that point....i log mine to a file after its ran
awhile.
 
Thank you but after the helpful tips ehre i found that i do not have a
memory leak. However if you are willing to share your code I will look at it
for sure and who knows maybe someone else might benefit from it.
 
You'll have to import System.Diagnostics first then call the function
below passing in where you are in your code...ie., something meaning
full to you...the trace stuff is just a fancy log file..u can replace
with debug.writeline if u wish

Public Sub fnLogMemoryUsage(ByVal psCodeLocation As String, ByVal
pTrace As TextWriterTraceListener)
dUsage = proc.PrivateMemorySize - iPrivMemSz
sUsage = dUsage.ToString("N").PadLeft(13) & " " &
proc.PrivateMemorySize.ToString("N").PadLeft(15)
pTrace.WriteLine(Now & " " & psCodeLocation & " --->>> " &
sUsage)
iPrivMemSz = proc.PrivateMemorySize
proc.Refresh()
End Sub
 
Back
Top