Subject: question about mapping
To: None <netbsd-users@netbsd.org>
From: Wojciech Puchar <wojtek@tensor.3miasto.net>
List: netbsd-users
Date: 03/30/2003 22:19:16
that's pmap of statically linked code of really simple program:

#include <unistd.h>
main() {sleep(10000);}


sleep just to be able to run pmap on it.

what i understand from listing that 4 pages (16K) are ELF file mapped
readonly executable (total file sys is about 15100 so <16K), then
one page is allocated for program data and bss (data got copied from elf
image), then 30720K is just stack barrier, 1964K is unused stack and 64k
us used stack

question: why 64K stack is used for such a simple thing?


08048000-0804bfff      16k 00000000 r-xp+ (rwx) 1/0/0 00:00   35374 -
/home/wojtek/1 [0xce6efb4c]
0804c000-0804cfff       4k 00000000 rw-p- (rwx) 1/0/0 00:00       0 -   [
anon ]
bdc00000-bf9fffff   30720k 00000000 ---p+ (rwx) 1/0/0 00:00       0 -   [
stack ]
bfa00000-bfbeffff    1984k 00000000 rwxp+ (rwx) 1/0/0 00:00       0 -   [
stack ]
bfbf0000-bfbfffff      64k 00000000 rwxp- (rwx) 1/0/0 00:00       0 -   [
stack ]
 total               2068k