Skip to content

Comment on Always Bump Downwards (2019)parent

Comments

Caller asks for a 500 megabyte downward bump allocation in a 32 bit system. Do you check for underflow or not?

You check to make sure the size requested is less than or equal to current pointer - chunk start and fail if it is bigger.

Let's face facts, the allocator, even with this additional check, is still going to be blazing fast compared to malloc() or whatever. If you're allocating so much that the handful of extra instructions is going to be a significant slowdown, maybe structure your allocations differently?

Most allocators will do this, yes.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.