3 ms·
> Even allocating 256MiB + 1 byte won't work, because you can't deallocate the old buffer until the new one has been allocated An allocator can (sometimes) gro
by dbaupp 12y ago
> Even allocating 256MiB + 1 byte won't work, because you can't deallocate the old buffer until the new one has been allocated
An allocator can (sometimes) grow the allocation in-place if there is unused space following it.
- arghnoname 12y agoEven better, as long as you have the address space available somewhere, if the allocation is done via mmap (as some allocators do for larger allocations), the physical page can be mapped to a different address in userspace and then allocate the new pages to be adjacent in the user address space. In this way, you don't even need the room after the current allocation.