Re:Bump Allocation: Up or Down?
by JonChesterfield on Tuesday March 26, 2024 @04:12AM
(#39825264)
Start as void*, current and/or end as size_t offsets from start is common.
The opposite way round works too, use a void* for end and current and/or end as offsets from that. 64 bit pointer and two 32 bit offsets might appeal on x64.
Without working through the arithmetic now I'd expect storing (size-current)=remaining instead of current to work well for the out of space check.
The opposite way round works too, use a void* for end and current and/or end as offsets from that. 64 bit pointer and two 32 bit offsets might appeal on x64.
Without working through the arithmetic now I'd expect storing (size-current)=remaining instead of current to work well for the out of space check.