Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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 25-Jan-13 13:35pm
Comments
Alhoot2004 at 25-Jan-13 20:11pm
   
Thank you Sergey
Sergey Alexandrovich Kryukov at 25-Jan-13 21:08pm
   
You are very welcome.
Good luck, call again.
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 432
1 OriginalGriff 250
2 CPallini 240
3 Abdul Samad KP 145
4 George Jonsson 119
0 OriginalGriff 6,329
1 Sergey Alexandrovich Kryukov 5,700
2 CPallini 4,940
3 George Jonsson 3,469
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100