fix: show_alloc_mem() can display detailed info properly

This commit is contained in:
0x35c 2024-09-21 12:19:04 +02:00
parent 943f2beab9
commit deca2b9bfc

View File

@ -2,7 +2,7 @@
#include "kprintf.h"
// FULL_INFO is to display (or not) both used and unused blocks
#define FULL_INFO 0
#define FULL_INFO 1
void show_alloc_mem(void)
{
@ -14,19 +14,19 @@ void show_alloc_mem(void)
for (Zone *zone_it = zones[type]; zone_it != NULL;
zone_it = zone_it->next) {
#if FULL_INFO
if (zone_it->kfree)
if (zone_it->free)
kprintf("---------- AVAILABLE %s [n°%d - %p] "
"----------\n",
zones_name[type], count, zone_it);
for (Block *block_it = zone_it->kfree; block_it != NULL;
block_it = block_it->next_kfree) {
for (Block *block_it = zone_it->free; block_it != NULL;
block_it = block_it->next_free) {
kprintf("%p - %p : %u bytes\n", block_it->ptr,
(size_t)block_it->ptr +
block_it->sub_size + sizeof(Block),
block_it->sub_size);
}
if (zone_it->kfree)
ft_printf("\n");
if (zone_it->free)
kprintf("\n");
#endif
if (zone_it->used)
kprintf("---------- IN_USE %s [n°%d - %p] "