Reputation: 187030
Is there a way in .net 2005 ide to find out the memory usage by variables inside a function and when their memory is made free by garbage collector.
Upvotes: 1
Views: 289
Reputation: 6182
For the first part of your question:
You can use a number of tools to profile the memory foot print of your application - down to individual lines of code. I can recommend the following tools:
For second part: GC in .net is not deterministic. It is called automatically when there is no free memory for the application. There is no tool which will tell you when GC has released memory back to free store.
Upvotes: 1
Reputation: 754585
I'm not sure what you're asking here. If you're looking for the memory footprint of a particular object, the best way to go is WinDbg and the SOS extension.
http://msdn.microsoft.com/en-us/library/bb190764.aspx
This can give you a multitude of information about the object heap including size and generational information.
This post here goes into detail about how to use WinDbg to get the size of an object graph. It may be what you're looking for
http://www.eggheadcafe.com/articles/20060114.asp
Upvotes: 0
Reputation: 14865
Have you looked at this question, which has a few approaches including
System.Runtime.InteropServices.Marshal.SizeOf(...)
You can look at GC.RegisterForFullGCNotification to see how to watch the garbage collector
Upvotes: 0