, , . , .
malloc sbrk, mmap . , 4096 . malloc. .
, , . , , , RAM []. [--] "" R/O.
ββ, , ββ , , . . / .
, . .
RSS ( )
RSS , , .
128 , (, 4 ), RSS 4 . RSS /, .
, - , RSS , , . , B "" A, RSS A B.
" " - , ββ , "". , .
3 , 10 , , /scattershot .
, RSS [ ], , . RSS , . - " ", - , "" .
malloc
, malloc . "" ( "" ). , malloc(32), () A, , malloc(1024 * 1024), (, B.).
"" 32 B, , malloc(1M)
, , "" 2.
, malloc , . , mmap . 4096, A 4096/32 128 .
munmap
free(ptr) [ptr ], . free , / .
, (.. , free . free [] munmap .
munmap [ ], , . , "" .
malloc_trim madvise
free, , , munmap. , RSS (, A) .
, , , /, .
A RSS. (, B) , A [ A RSS], B [ RSS ].
, B, , A RSS . , 100 , , 1 , RSS 100 .
, "" B ββ A, " " RSS.
, , syscall madvise MADV_WONTNEED. , , [] , RSS.
, . , .
, , ββ RAM . RSS . .
madvise malloc_trim RSS .