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,
            Asked
            
        
        
            Active
            
        
            Viewed 107 times
        
    4
            
            
        - 
                    I meant instantiated in memory. – Nair May 11 '11 at 18:58
3 Answers
3
            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:
- http://memprofiler.com
- http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/
- http://www.xteprofiler.com/ (supports Silverlight)
SO question: What Are Some Good .NET Profilers?
1
            
            
        Its not built into Visual Studio, but you can use CLRProfiler to visualize allocations on the heap.
 
    
    
        foson
        
- 10,037
- 2
- 35
- 53
0
            
            
        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.
 
    
    
        Cory Nelson
        
- 29,236
- 5
- 72
- 110
 
     
    