????????????????????????????????????????伴?????????????????????????????????С???????????/proc/{pid}/maps????????????????????????????????в????????????

# cat /proc/568/maps

00008000-0036a000 r-xp 00000000 00:0e 236        /home/hik/hicore
00372000-003a5000 rw-p 00362000 00:0e 236        /home/hik/hicore
003a5000-00e28000 rwxp 003a5000 00:00 0          [heap]
40000000-40005000 r-xp 00000000 01:00 94         /lib/ld-uClibc.so.0
416db000-41770000 rw-s c2005000 00:0f 68         /dev/mem
b51fc000-b5200000 rwxp b51fc000 00:00 0
…….
be1fc000-be200000 rwxp be1fc000 00:00 0
be93b000-be950000 rwxp befeb000 00:00 0          [stack]

????????У???r-xp??????????????????У?????????????????????????Σ????????????????????в??????С??????????????????????????????????????

????????У???rw-p????????????д????????У??????????????????????????Σ??????????????????????????????????

?????????У???rwxp????????????д??????У?????????????????????????????????Σ????????malloc????????????Ρ????????????????Σ????????????????????????????????棬???????????????Ρ?????????????????????????1GB??λ?????0x40000000?????????1GB??glibc??????mmap??????????????????檔

?????????У???????????????????????

?????????У?????mmap????????????????

?????????????У??????????????Σ???????????С????16K??

????????У??????????????????Σ?????????????????????????ж????????????????Ρ?

??????????????????????

????1?????????????????????????maps??????????

????2??????????????????????ò?????????????tmpfs??????£????????????????13M????????????????cache???????????????????????cache?????????????????????????????

????3?????????ramdisk??????檔

????4????????????????С???????????/proc/sys/vm/min_free_kbytes??????????????????С??

????5????????????????????????????????????????????????д???cache???????縺??????????skb?????????30M?????

???????????????й?????????Щ???

???????????????????????????glibc??????????????????????????????????????????????????????????????????????????????????????????檔

????????ε??????????????????????brk??mmap??brk????????????????mmap??????????????????????

????????????glibc????????????????????????????????????????glibc?????mmap?????????????????????????????brk???????????????????£???????128K??????????????????????

#include <malloc.h>

????Int mallopt(int param?? int value)

????Param????????M_MMAP_THRESHOLD??M_MMAP_MAX??

????Value??????????????λ???

????M_MMAP_THRESHOLD??glibc??????????淧???????÷????????????????????????mmap????????????棬???С??÷??????????????????????brk???????????????

????M_MMAP_MAX??y????ж????mmap???????ε???????

????????????????????У?????????????????й?????????y????maps???????????λ???mmap?ε???????????????????????????????????????????й??????mmap?????????????????????????????????ε????????????С?????????????????????????棬????????й?????????????????λ???á?