tags:

views:

136

answers:

4

Hello,

is there a way to get, for debuging 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

A: 

You can create a tool, that will monitor size of process.
Or do this in seperate thread of running application. Process.GetProcessesByName()...

durza
But I need the memory on a per object basis, not the whole process. For example object a (containing b and c) is using 200MB, b is using 150MB and c is using 50MB.
Chris
A: 

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.

martijn_himself
+2  A: 

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)

MaLio
+1  A: 

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.

Turek