Click here to Skip to main content
12,952,792 members (36,255 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I'm writing a (VS2008,.Net_framework 3.5 , 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
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.

1 solution

Rate this: bad
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[^].


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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,389
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2017
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