1

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.

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

2 Comments

That only returns the unmanaged memory size, not the managed size.
Actualy i was looking for something like callstack, watch etc and not by writing code. Is there any option within the IDE to track memory allocations
0

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

2 Comments

Actualy i was looking for something like callstack, watch etc and not by writing code. Is there any option within the IDE to track memory allocations
@Strike, windbg is a debugger and doesn't require any code. There is no way to actually track an allocation in the IDE currently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.