C # - is it possible to iterate a GC Heap?

I am not sure if the following questions are valid. To educate myself, I just ask.

(1) Can I programmatically iterate over the GC-heap of all generations?

(2) Can I see how the GC works on my build by starting a thread?

+5
source share
2 answers

Answers to your questions:

  • Unfortunately no, you cannot. The CLR garbage collector works with a label, a scan, a compact design, so there is no heap information between runs (except for the size of the heap or the current generation of an instance of a specific type), which allows you to iterate through all the objects in it.

  • GC - perfmon ( ) CLR.

+7

- , GC- .

, WinDbg SOS. dumpheap, , GC. dotTrace, .

+2

All Articles