1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS: Show class in SerenityOS mmap name for type-specific allocators

This commit is contained in:
Andreas Kling 2023-12-31 12:39:46 +01:00
parent b6d4eea7ac
commit ee3d09f225
4 changed files with 19 additions and 9 deletions

View file

@ -18,11 +18,14 @@
namespace JS {
NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, CellAllocator& cell_allocator, size_t cell_size)
NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, CellAllocator& cell_allocator, size_t cell_size, [[maybe_unused]] char const* class_name)
{
#ifdef AK_OS_SERENITY
char name[64];
snprintf(name, sizeof(name), "LibJS: HeapBlock(%zu)", cell_size);
if (class_name)
snprintf(name, sizeof(name), "LibJS: HeapBlock(%zu): %s", cell_size, class_name);
else
snprintf(name, sizeof(name), "LibJS: HeapBlock(%zu)", cell_size);
#else
char const* name = nullptr;
#endif