64位机器上内核常用数据结构的大小

来源:互联网 发布:android 网络异常汇总 编辑:程序博客网 时间:2024/06/05 13:12

unsigned long long:8

void*:8

the size of __u64:8

the size of __u32:4

the size of __u16:2

the size of __u8:1

the size of rwlock_t:4

the size of list_head:16

the size of atomic_t:4

the size of unsigned long:8

the size of long:8

the size of unsigned int:4

the size of int:4

the size of char:1

 

另外在64位机器上,感觉是按32位对齐分配内存的。

以下为2个实际的例子:

 

一个结构体a的大小为24B,但实际上为它分配了32B

一个结构体a的大小为16B,但实际上为它分配了32B

 

如果是struct a[32] , 且sizeof(struct a)=16

strcut a p1[32];

struct a p2[32];

 

p1 与 p2 地址的区别为32*16。

原创粉丝点击