mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
parent
58bc10b947
commit
b8fd845885
1 changed files with 10 additions and 2 deletions
|
@ -33,8 +33,16 @@ BlockAllocator::~BlockAllocator()
|
|||
|
||||
void* BlockAllocator::allocate_block([[maybe_unused]] char const* name)
|
||||
{
|
||||
if (!m_blocks.is_empty())
|
||||
return m_blocks.take_last();
|
||||
if (!m_blocks.is_empty()) {
|
||||
auto* block = m_blocks.take_last();
|
||||
#ifdef __serenity__
|
||||
if (set_mmap_name(block, HeapBlock::block_size, name) < 0) {
|
||||
perror("set_mmap_name");
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
#endif
|
||||
return block;
|
||||
}
|
||||
|
||||
#ifdef __serenity__
|
||||
auto* block = (HeapBlock*)serenity_mmap(nullptr, HeapBlock::block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_RANDOMIZED | MAP_PRIVATE, 0, 0, HeapBlock::block_size, name);
|
||||
|
|
Loading…
Add table
Reference in a new issue