Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLR Profiler - Attaching to existing process

I would like to use something like CLR Profiles on .Net 2.0 to see what objects are taking more space in the heap at any given time (of an ASP.Net worker process).

However, the CLR Profiler only lets me START an app, not attach to an existing one. I assume this is because it tracks allocations and GC too, but i'm not very interested in that. I would just like something that takes a snapshot of the current state of the heap, and shows me what is there and how many objects of each kind there are, and how many bytes total are being used by each object type.

Any ideas?

like image 663
Daniel Magliola Avatar asked Aug 29 '08 00:08

Daniel Magliola


1 Answers

  • Attach a debugger

cdb -p

  • load .net debugger extensions

.loadby sos mscorwks

  • dump the heap in a format the CLRProfiler understands

!TraverseHeap heap.txt

  • detach debugger

qd

  • load heap.txt in the clrprofiler app
like image 152
Peli Avatar answered Sep 20 '22 23:09

Peli