简体   繁体   中英

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?

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

在此输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM