hardened_malloc is a security-focused replacement for the C heap allocator, compiled as a shared library and used either via LD_PRELOAD or integrated directly into a libc such as Bionic on GrapheneOS. It implements the full malloc family (malloc/calloc/realloc/free, posix_memalign/aligned_alloc, malloc_usable_size) plus hardened extensions such as malloc_object_size, free_sized, and free_aligned_sized, along with C++ operator new/delete wrappers. Its architecture is a single monolithic C library: all mutable allocator state lives in one read-only-after-init metadata region; slab allocations are partitioned into per-size-class regions inside statically reserved address space, and large allocations are mmap-backed with randomized guard pages and a quarantine. It targets 64-bit Linux and currently builds against Bionic, glibc, and musl.
gperftools is a production-grade C++ performance tools library, primarily known for its thread-caching malloc (tcmalloc) that replaces the standard libc malloc/free and C++ new/delete. The library provides significant performance improvements for multi-threaded applications by reducing lock contention through per-thread caches. In addition to the allocator, it offers CPU profiling (via timer-based sampling), heap profiling, heap leak checking (deprecated stub), and a debug allocator with corruption detection. The codebase is cross-platform (Linux, Windows, macOS, BSD) and includes extensive unit tests and benchmarks. It is consumed as a shared or static library, linked with `-ltcmalloc` or `-ltcmalloc_minimal`. The repository also contains vendored dependencies (Google Test, libbacktrace) and supports multiple build systems (autotools primary, CMake preliminary, Bazel experimental).