Nair
Nair

Reputation: 7458

How can I find out what items get generated in memory when debugging c#?

Just curious, is it possible to find out, what items are generated while the program is running in stack and heap? Is there a tool or meachanism out there to identify memory usage in VS2010 C# (Silverlight)? Thanks,

Upvotes: 4

Views: 107

Answers (3)

Cory Nelson
Cory Nelson

Reputation: 30031

Reference types are always allocated on the heap. I believe you can assume that value types are allocated on the stack. I don't know of any tools that will show your total stack usage, though.

You can use GC.GetTotalMemory() to determine your app's heap usage.

Upvotes: 0

robertos
robertos

Reputation: 1796

Yes, you can use the Visual Studio Profiler (or any other profiler).

Tutorial: http://msdn.microsoft.com/en-us/magazine/cc337887.aspx

Other memory profilers:

SO question: What Are Some Good .NET Profilers?

Upvotes: 3

foson
foson

Reputation: 10227

Its not built into Visual Studio, but you can use CLRProfiler to visualize allocations on the heap.

Upvotes: 1

Related Questions