is there a way to get, for debug开发者_C百科ing purpose, a list of needed RAM for all my objects incl. sub-objects and so on, written to a text-file?
I need to get these values while running in production mode without visual studio running. For example every x minutes. Is this possible? How can I do that?
Thank you very much in advance,
Chris
Load windbg and load sos.dll, and attach to process.
log the output to a file
then do a !DumpHeap -stat
(and variants)
psscor2.dll can dump the heap to an xml file. (or one for use with ClrProfiler)
You can use JetBrains DotTrace to do the memory profiling. Its only 30 days trial but what a great tool to navigate through specific in-memory objects.
You can create a tool, that will monitor size of process.
Or do this in seperate thread of running application.
Process.GetProcessesByName()...
For value types, you should be able to use sizeof(). I don't think there is an equivalent for reference types, though. Note you can only use sizeof() inside an unsafe block.
精彩评论