Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I'm writing a (VS2008,.Net_framework 3.5 ,VB.net) application

When I close a form with a big memory usage , I check the Taskmanager
and found that it ( the form ) didn't release all the memory that was allocated , I tried many approachs but I think that all of them wasn't the proper one cause the problem still there , or maybe I didn't catch the point the right way. [for example : GC.collect , Me=nothing , Me.dispose , GC.SuppressFinalize(Me) .. etc ; quoted from the web. ]

My question is : Is this a/the right free way (cause I don't have profiler) to check the memory usage of application..

And how can I release all the memory allocated for a form


Thank you very much
Posted
Comments
Alhoot2004 25-Jan-13 20:11pm    
Thank you Sergey
Sergey Alexandrovich Kryukov 25-Jan-13 21:08pm    
You are very welcome.
Good luck, call again.
—SA

1 solution

The estimate done using TaskManager is so unreliable that is should not be taken in consideration. What it shows is not a really allocated memory. If you terminate some process, even unmanaged, all memory is reclaimed, period.

Also, you should not really do anything with GC. Just don't.

It does not mean that with manages systems memory leaks are impossible. They are quite possible, but understanding of it requires more accurate consideration of what a memory leak is; this is not as trivial. In managed system, you are protected from accidental memory leaks, but you can easily create quite real design-level memory leaks. For further detail, please see my past answers:
Garbage collectotion takes care of all the memory management[^],
deferring varirable inside the loop can cuase memory leak?[^],
Best way to get rid of a public static List Causing an Out of Memory[^],
Memory management in MDI forms[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900