Redis does not rely on the native glibc malloc implementation. Instead, it overrides malloc via zmalloc.h/zmalloc.c to use either jemalloc (default on Linux/Ubuntu) or tcmalloc (by Google/Facebook). The reason is that native malloc leads to memory fragmentation — especially problematic for an in-memory database doing frequent small allocations and deallocations. jemalloc and tcmalloc manage memory in large chunks internally, perform defragmentation, and handle concurrency more efficiently, making them far better suited for high-throughput workloads like Redis. The switch is controlled by compile-time flags and can be tuned or benchmarked per use case.

6m watch time
74 Impressions