diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-02 02:58:06 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-02 02:58:06 +0200 |
commit | 2dc72bb2974f12667cf8a934ba5fefcc78b6debb (patch) | |
tree | 8f7dfb3abdeca07aab2e70c0c60797a1a7616c9c /LibC | |
parent | 4291e96991515217a692e8049e72bff8d542435d (diff) | |
download | serenity-2dc72bb2974f12667cf8a934ba5fefcc78b6debb.zip |
LibC: Improve malloc() mmap names somewhat.
Diffstat (limited to 'LibC')
-rw-r--r-- | LibC/malloc.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/LibC/malloc.cpp b/LibC/malloc.cpp index ade854eb4a..5b7cf8ef26 100644 --- a/LibC/malloc.cpp +++ b/LibC/malloc.cpp @@ -123,9 +123,12 @@ void* malloc(size_t size) if (!allocator) { size_t real_size = sizeof(BigAllocationBlock) + size; - void* page_ptr = os_alloc(real_size); - BigAllocationBlock* bigalloc_header = new (page_ptr) BigAllocationBlock(real_size); - return &bigalloc_header->m_slot[0]; + auto* block = (BigAllocationBlock*)os_alloc(real_size); + char buffer[64]; + snprintf(buffer, sizeof(buffer), "malloc: BigAllocationBlock(%u)", good_size); + set_mmap_name(block, PAGE_SIZE, buffer); + new (block) BigAllocationBlock(real_size); + return &block->m_slot[0]; } assert(allocator); @@ -138,7 +141,7 @@ void* malloc(size_t size) if (!block) { block = (ChunkedBlock*)os_alloc(PAGE_SIZE); char buffer[64]; - snprintf(buffer, sizeof(buffer), "malloc() page (%u)", good_size); + snprintf(buffer, sizeof(buffer), "malloc: ChunkedBlock(%u)", good_size); set_mmap_name(block, PAGE_SIZE, buffer); new (block) ChunkedBlock(good_size); allocator->append(block); |