最近在研究OS,网上有一张图,展示了用户空间和内核空间的内存布局,以及栈、堆等的布局。
在这个图中我看到栈位于用户空间的最高内存地址,高于堆、数据段等。
为了检查这一点,我在调试视图下使用了 vs2012 中的内存观察器窗口,这是我的代码:
int a = 3;
int main()
{
int b = 5;
int *p = new int[100];
delete [] p;
return 0;
}
And I checked the memory address of a(data segment),b(stack variable) and p(heap)
, but I found the address of b is the lowest among the three, so why is the result different from the picture above?
该图像看起来像 Linux 布局虚拟地址空间的方式,而不是 Microsoft Windows。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)