Reputation: 215
I do not know if this the correct forum to ask this question but I am a fan of stackoverflow and so have decided to go ahead posting it here.
If I output the /proc//smaps, I find several segments which do not have any name associated with them and also with inode number as 0. As per the linux kernel Documentation, 0 indicates that no inode is associated with the memory region, as the case would be with BSS (uninitialized data).
I tried searching for BSS but could not get exactly what it is. The information that I got is that BSS is that segment of memory responsible for unititalised global and static variables.
My question is what else does memory region with inode number 0 contain?
I wrote a C program in which I dd the following:- (i) Malloc 4 Mb for an array on integers (ii) Cat /proc//smaps (iii) Found an added memory segment with inode number "0" in the smaps. (iv) Inittialised some part of this array to 5.
STILL found that this memory segment is attached with inode number 0 only. Another question is when does this memory segment get converted to heap?
Upvotes: 2
Views: 2683
Reputation: 239121
The mappings with inode number 0 are anonymous mappings - essentially those that have been created with the MAP_ANONYMOUS
flag to mmap()
.
This just means that they aren't associated with a disk file. The inode number isn't going to change though; it'll always stay as 0 for that mapping.
Anonymous mappings don't get converted to heap. In fact "[heap]" is just a convenience marker for the anonymous mapping that is set up by the kernel at exec time and altered by the brk()
system call.
Upvotes: 2