开发者

Linux assembly; bss section memory initialized to 0?

In tests I have run the memory in the bss section of my programs has always been开发者_开发百科 initialized to zero before I write anything there. Is this coincidental, or is the system "cleaning" these memory pages before handing them to me? I am using the nasm assembler on Ubuntu (if that possibly makes a difference).


Your application's executable file(ELF) has a BSS section's size information, when it starts up, kernel allocate a block of memory for BSS section, and clean it to 0. This defined by ABI(Application Binary Interface), so you needn't worry about there are different on different machine.


Yes BSS is initialized to zero.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜