Who is responsible for deallocating memory reserved in the .bss section of an image?
If I reserve memory in the .BSS section of an image, am I responsable for deallocating that memory before the process terminates and if so how do I go about doing this?
Here's some example code to clarify
SECTIION .text
GLOBAL _start
_start:
mov edx, buffer
movb [edx], 30h ; Initializes buffer which was reserved in .bss
...
SECTION .bss
buffer: RESB 2 ; Reserves 2 bytes开发者_开发知识库 in .bss section
The loader allocates that memory before your process starts executing, and the kernel will automatically reclaim it when your process exits. You do not need to worry about it.
精彩评论