LibJS: Don't generate unused HeapBlock names on non-SerenityOS systems

These are just ignored by the BlockAllocator anyway.
This commit is contained in:
Andreas Kling 2021-06-13 11:29:01 +02:00
parent 095accd2b2
commit b458090d14

View file

@ -20,8 +20,12 @@ namespace JS {
NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, size_t cell_size)
{
#ifdef __serenity__
char name[64];
snprintf(name, sizeof(name), "LibJS: HeapBlock(%zu)", cell_size);
#else
char const* name = nullptr;
#endif
auto* block = static_cast<HeapBlock*>(heap.block_allocator().allocate_block(name));
new (block) HeapBlock(heap, cell_size);
return NonnullOwnPtr<HeapBlock>(NonnullOwnPtr<HeapBlock>::Adopt, *block);