您的位置:首页 > 其它

【VS】关于内存分布查看的方式

2017-05-17 16:46 218 查看
class Base
{
public:
int a;
Base()
{
cout<<"Base()"<<endl;
}
~Base()
{
cout<<"~Base()"<<endl;
}
virtual fun()
{
cout <<"Base fun()"<<endl;
}
};

class Derived:public Base
{
public:
Derived()
{
cout<<"Derived()"<<endl;
}
~Derived()
{
cout<<"~Derived()"<<endl;
}
};



选择项目属性 C/C++  命令行  附加选项   添加  /d1 reportAllClassLayout  则会打印所有的内存信息。。

/d1 reportSingleClassLayoutBase 则是打印单个类的内存信息。。


F7 编译时,选择输出窗口,生成  如下图:




内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: