博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux和windows内存布局验证
阅读量:4060 次
发布时间:2019-05-25

本文共 1367 字,大约阅读时间需要 4 分钟。

#if 1
//内存布局的验证
#include <stdio.h>
int globle_init = 0;
int globle_uinit;
static int globle_static = 0;
int main()
{
int local_init = 0;
static int local_static = 0;
int *local_ptr;
local_ptr = (int *)malloc(10);
printf("address of main is %p\n", main);
printf("address of globle_init is %p\n", &globle_init);
printf("address of globle_uinit is %p\n", &globle_uinit);
printf("address of globle_static is %p\n", &globle_static);
printf("address of local_init is %p\n", &local_init);
printf("address of local_static is %p\n", &local_static);
printf("address of &local_ptr is %p\n", &local_ptr);
printf("address of local_ptr is %p\n", local_ptr);
//
/*
//windows
address of &local_ptr is 0031FB70 stack
address of local_init is 0031FB7C stack
address of local_ptr is 00378820 heap
address of main is 00AD1145 text
address of globle_init is   00AD8130   data
address of globle_static is 00AD8134 data
address of local_static is  00AD8138 data
address of globle_uinit is  00AD8160 data
//linux
address of local_init is 0x7fff4397784c stack
address of &local_ptr is 0x7fff43977840 stack
address of local_ptr is 0x828010         heap
address of globle_uinit is 0x601064 data
address of local_static is 0x601060 data
address of globle_static is 0x60105c data
address of globle_init is 0x601058 data
address of main is 0x400650 text
*/
//
free(local_ptr);
printf("ok\n");
return 0;
}
#endif

转载地址:http://yabji.baihongyu.com/

你可能感兴趣的文章
my pdfs
查看>>
framework Schedule Quartz
查看>>
IBM WebSphere Commerce Analyzer
查看>>
Unix + OS IBM Aix System Director
查看>>
Unix + OS IBM Aix FTP / wu-ftp / proftp
查看>>
framework apache commons
查看>>
my read work
查看>>
blancerServer IBM WebSphere Edge Server 6.1
查看>>
db db2 base / instance database tablespace container
查看>>
my read _job
查看>>
hd disk / disk raid / disk io / iops / iostat / iowait / iotop / iometer
查看>>
project ASP.NET
查看>>
db db2_monitorTool IBM Rational Performace Tester
查看>>
OS + Unix Aix telnet
查看>>
IBM Lotus
查看>>
Linux +Win LAMPP Tools XAMPP 1.7.3 / 5.6.3
查看>>
my read_university
查看>>
network manager
查看>>
searchServer IBM OminiFind / WebSphere Commerce SOLR
查看>>
OS + Linux Disk disk lvm / disk partition / disk mount / disk io
查看>>