• Yedidya Feldblum's avatar
    reentrant_allocator · 05fe3c7b
    Yedidya Feldblum authored
    Summary:
    [Folly] `reentrant_allocator`, a multi-thread-safe and async-signal-safe allocator.
    
    Based on `mmap` for dynamic allocation. While, technically, `mmap` is not documented to be async-signal-safe, in practice it is so at least on Linux. Take advantage.
    
    Details:
    * Large allocations are handled directly by `mmap` and deallocations by `munmap`, where large-size is 2^12 (1 page) by default; they are not tracked; they are aligned only to page boundaries.
    * Small allocations are handled by an `mmap`-backed refcounted arena list. Arena sections are block-size bytes less overhead by default, where block-size is 2^16 (16 pages) by default; they are allocated on demand; and they are linked together to allow for `munmap` when the allocator refcounted arena list is destroyed.
    
    Reviewed By: nbronson, luciang
    
    Differential Revision: D19222635
    
    fbshipit-source-id: adf30580c1bf3dd7f8dab13b1d4ac1e10b2f5c52
    05fe3c7b
CMakeLists.txt 34.1 KB