News for hackers. Stuff that matters.
Re:So you want custom allocator support in your C library by lifthrasiir on Sunday December 17, 2023 @09:09PM (#38678517)
An allocator that fully trusts the size provided to `free` is hugely unsafe when the size turns out to be incorrect. As an extreme example, the allocator may know that every 4-byte allocation is put into the arena that is aligned to 0x1000-byte block, so it may jump straight into the arena header which won't be there if the size was incorrect. So a real-life allocator is likely to do some checking even when the size is provided, but that checking can be much more simplified in that case.

There are no comments on this comment yet.