• Mark Santaniello's avatar
    Use sized deallocation in SysAllocator and Arena · 0d2bdbf0
    Mark Santaniello authored
    Summary:
    Use sized-deallocation (`sdallocx`) if possible in `folly::SysAllocator` and `folly::Arena`.
    
    `Arena` has always allocated two types of blocks:
    1. Normal (fixed-sized): size is the "goodSize adjusted" `minBlockSize`
    2. Large (variable-sized): when #1 is too small
    
    Type #2 makes sized-deallocation tricky -- we need somewhere to remember the allocated sizes.
    
    The old code used a single type `Block` and kept a single list. Here I change to have two types and two lists.  The `LargeBlock` has an additional `allocSize` data member.
    
    This makes the Arena object itself 16B larger, but seems better than adding a 4B `allocSize` to each and every block, regardless of type.
    
    Note that, prior to this change, it was possible to `merge()` arenas with different `minBlockSize`.  This is no longer possible.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D22189916
    
    fbshipit-source-id: e6fba48eaae0b5cc8456b856b02d2cfc71c03834
    0d2bdbf0
Arena-inl.h 2.93 KB