SMAPS Unnamed Memory Segment

I don't know if this forum asked this question correctly, but I'm a stackoverflow fan and therefore decided to continue posting it here.

If I output / proc // smaps, I find several segments that have no name associated with them and also have an inode number as 0. According to the Linux kernel documentation, 0 indicates that no inode is associated with as it would be with BSS (uninitialized data).

I tried searching for BSS but couldn't figure out what it is. The information I got is that the BSS is the memory segment responsible for unified globals and static variables.

My question is, what else does the memory area with index number 0 contain?

I wrote a C program in which I wrote the following: (i) Malloc 4 Mb for an array of integers (ii) Cat / proc / smaps (iii) Found an extra memory segment with inode number "0" in the clouds. (iv) Initializing some part of this array to 5.

STILL found that this segment of memory is connected only with inode number 0. Another question: when is this segment of memory converted to heap?

+2


a source to share


1 answer


The mappings with inode number 0 are anonymous mappings - essentially the ones created with the flag MAP_ANONYMOUS

before mmap()

.

This means they are not associated with the disk file. However, the inode index will not change; it will always remain 0 for this mapping.



Anonymous mappings are not heap-converted. In fact, "[heap]" is just a convenience token for anonymous matching that is set by the kernel at runtime and changed by a system call brk()

.

+2


a source







All Articles