• B
    Add zcalloc and use it where appropriate · 399f2f40
    Benjamin Kramer 提交于
    calloc is more effecient than malloc+memset when the system uses mmap to
    allocate memory. mmap always returns zeroed memory so the memset can be
    avoided.  The threshold to use mmap is 16k in osx libc and 128k in bsd
    libc and glibc. The kernel can lazily allocate the pages, this reduces
    memory usage when we have a page table or hash table that is mostly
    empty.
    
    This change is most visible when you start a new redis instance with vm
    enabled.  You'll see no increased memory usage no matter how big your
    page table is.
    399f2f40
dict.c 20.5 KB