summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Heap
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-21 13:12:16 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-21 13:12:16 +0100
commit2a7dbac0c5038456ea21d6fbe0888ec022fb73da (patch)
tree40074336d39125c105b7a3e81d311a8f78a78e23 /Libraries/LibJS/Heap
parent00feef86427b7a370ba292f7eca426839ae5699d (diff)
downloadserenity-2a7dbac0c5038456ea21d6fbe0888ec022fb73da.zip
LibJS: Include the cell size in HeapBlock mmap names
HeapBlocks now show up in SystemMonitor as "LibJS: HeapBlock(32)" :^)
Diffstat (limited to 'Libraries/LibJS/Heap')
-rw-r--r--Libraries/LibJS/Heap/HeapBlock.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibJS/Heap/HeapBlock.cpp b/Libraries/LibJS/Heap/HeapBlock.cpp
index 3055547422..86a4b41a65 100644
--- a/Libraries/LibJS/Heap/HeapBlock.cpp
+++ b/Libraries/LibJS/Heap/HeapBlock.cpp
@@ -28,13 +28,16 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/kmalloc.h>
#include <LibJS/Heap/HeapBlock.h>
+#include <stdio.h>
#include <sys/mman.h>
namespace JS {
NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, size_t cell_size)
{
- auto* block = (HeapBlock*)serenity_mmap(nullptr, block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0, block_size, "HeapBlock");
+ char name[64];
+ snprintf(name, sizeof(name), "LibJS: HeapBlock(%zu)", cell_size);
+ auto* block = (HeapBlock*)serenity_mmap(nullptr, block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0, block_size, name);
ASSERT(block != MAP_FAILED);
new (block) HeapBlock(heap, cell_size);
return NonnullOwnPtr<HeapBlock>(NonnullOwnPtr<HeapBlock>::Adopt, *block);