Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way in Visual Studio to see the actual objects in memory

I would like to see the objects created by my program. I searched on google and stack and I looked around in visual studio but I can't find anything about this.

I'm not looking for memory usage analyzer view. I just want to see all created objects and their values.

Is there a way to see all live objects in Visual Studio 2015?

like image 716
botenvouwer Avatar asked Jan 01 '17 12:01

botenvouwer


1 Answers

You can see the memory of the object by using Memory window in VS.

Just go to Debug->Windows->Memory and open one of the four available or use the shortcut Ctrl+Alt+M, 1-4. Then while debugging the application just type the name of the variable in the address field to translate it to a memory location and show the memory.

Assuming you code is like this:

var memObject = new MemObject {IntField = 42, StringField = "String"};
var str = "My string";

and you have a breakpoint after the second line. When you type str into and address field you will be moved to the memory location of this object

enter image description here

the same goes with writing memObject there.

If you want to see all the objects I think the only way is to us sos in WinDbg.

like image 107
Paweł Łukasik Avatar answered Oct 09 '22 23:10

Paweł Łukasik