summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-13 11:29:01 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-13 19:11:29 +0200
commitb458090d1403095a52f1965ed394fd91d436fff4 (patch)
treef5ebb8700b47e7f3ccbef1143882c9373509340b
parent095accd2b244d1e0e3d9720828ec32b618797813 (diff)
downloadserenity-b458090d1403095a52f1965ed394fd91d436fff4.zip
LibJS: Don't generate unused HeapBlock names on non-SerenityOS systems
These are just ignored by the BlockAllocator anyway.
-rw-r--r--Userland/Libraries/LibJS/Heap/HeapBlock.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp
index 4999be117f..000cac593d 100644
--- a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp
+++ b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp
@@ -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);