alloc/chunked: add oversize chunk allocation
This commit is contained in:
parent
a5c69c5911
commit
03f702df4c
@ -64,7 +64,13 @@ chunked::do_allocate (std::size_t size, std::size_t alignment)
|
||||
}
|
||||
|
||||
// No chunk was found. We need to allocate a new chunk of at least enough size.
|
||||
unimplemented ();
|
||||
std::size_t allocation_size = cruft::max (size + alignment, m_chunk);
|
||||
std::unique_ptr<std::byte[]> ptr (new std::byte[allocation_size]);
|
||||
m_data.push_back (arena { ptr.get () });
|
||||
m_data.back ().node->size = allocation_size;
|
||||
m_data.back ().node->next = m_data.back ().node;
|
||||
ptr.release ();
|
||||
return do_allocate (size, alignment);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user