logoalt Hacker News

tcfhgjtoday at 9:19 AM1 replyview on HN

Why not though?

Have a boxed object have implemented drop, then when the box leaves some scope the Box will clean up it's stuff (drop implementation if there is any) and deallocate it's memory using the allocator (which the arena will treat as noop).


Replies

delamontoday at 9:26 AM

Yes, that would work. But you would need to carry pointer to allocator inside box and it is extra code to run for every object.

show 1 reply