Finding memory leaks in VB.Net

D

Dennis K.

I have a VB.Net application that does a lot of recursion. Task Manager
shows about 19,400K in Mem Usage when the main process starts and about
31,600K when it ends. I have GC.Collect in the relevant code. Subsequent
invocations of the process just add to the Mem Usage. I am pretty sure I
am allocating objects on the heap that are not getting garbage
collected. No doubt this is my fault, but is there some way to track
this down in VB.Net? I know that VC tells you about objects that were
not deleted ... I was hoping for something similar in VB.Net.

Thanks,
 
P

Patrick Steele

I have a VB.Net application that does a lot of recursion. Task Manager
shows about 19,400K in Mem Usage when the main process starts and about
31,600K when it ends. I have GC.Collect in the relevant code. Subsequent
invocations of the process just add to the Mem Usage. I am pretty sure I
am allocating objects on the heap that are not getting garbage
collected. No doubt this is my fault, but is there some way to track
this down in VB.Net? I know that VC tells you about objects that were
not deleted ... I was hoping for something similar in VB.Net.

The .NET garbage collector runs when it needs to (and calling GC.Collect
yourself usually results in a less efficient garbage collection).

Basically, if no other application on your machine is requesting more
memory than is available, there's no need for the garbage collector to
run. When objects go out of scope, they're flagged as available for
deletion from the heap. But until there's pressure on the heap, GC
usually doesn't occur -- i.e. why go out and buy more milk if you've got
plenty in the fridge and no one is drinking that much... :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top