mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
LibJS: Include the cell size in HeapBlock mmap names
HeapBlocks now show up in SystemMonitor as "LibJS: HeapBlock(32)" :^)
This commit is contained in:
parent
00feef8642
commit
2a7dbac0c5
1 changed files with 4 additions and 1 deletions
|
@ -28,13 +28,16 @@
|
||||||
#include <AK/NonnullOwnPtr.h>
|
#include <AK/NonnullOwnPtr.h>
|
||||||
#include <AK/kmalloc.h>
|
#include <AK/kmalloc.h>
|
||||||
#include <LibJS/Heap/HeapBlock.h>
|
#include <LibJS/Heap/HeapBlock.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, size_t cell_size)
|
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);
|
ASSERT(block != MAP_FAILED);
|
||||||
new (block) HeapBlock(heap, cell_size);
|
new (block) HeapBlock(heap, cell_size);
|
||||||
return NonnullOwnPtr<HeapBlock>(NonnullOwnPtr<HeapBlock>::Adopt, *block);
|
return NonnullOwnPtr<HeapBlock>(NonnullOwnPtr<HeapBlock>::Adopt, *block);
|
||||||
|
|
Loading…
Add table
Reference in a new issue