ubuntu - Who zeroes pages while calling calloc() in Linux? -
i aware implementer has choice of whether wants 0 malloc page or let os give him zeroed page (for more optimization purposes).
my question simple - in ubuntu 14.04 lts comes linux kernel 3.16 , gcc 4.8.4, 0 pages? in user land or kernel land?
it can depend on memory came from. calloc
code userland, , 0 memory page gets re-used process. happens when memory used , freed, not returned os. however, if page newly allocated process, come cleared 0 os (for security purposes), , not need cleared calloc
. means calloc
can potentially faster calling malloc
followed memset
, since can skip memset
if knows zeroed.
Comments
Post a Comment