Arena allocation

Steadman Dillroper <dillstead@gmail.com>
Message ID
DKIM signature
Download raw message
Hi Chris,

I spent a good 45 minutes staring at the code for arena allocation and
trying to find the defect if I changed ptrdiff_t to size_t and I
couldn't eyeball it.  I compiled the code and played around with it
calling it with reasonable inputs to no avail.  I also reread the
article by Stroustrup to refresh my memory - still couldn't find it.
Would you mind providing a hint?

BTW, a really neat trick to compute the padding.  Also, inlining the
assembly to allow the compiler to optimize - brilliant.


Message ID
<CAOJH3v5275PcV9heccdPo77=WzQq2xZQuyrkYHUi1nJ-XBC5kQ@mail.gmail.com> (view parent)
DKIM signature
Download raw message
I'm glad you've given it a shot, Steadman! Hint: Consider what happens in 
the "if" condition when the arena is exactly at capacity and a non-zero 
number of padding bytes are required for alignment. That is, "padding" is 
greater than "avail".
Reply to thread Export thread (mbox)