From 6c8d6354bc8ff52998a5370319a6a42104d932fe Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 9 Jul 2024 22:12:55 +0200 Subject: [PATCH] Add debug in memtool to see where it hangs --- JOURNAL.md | 7 +++++++ memtool.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/JOURNAL.md b/JOURNAL.md index b18a591..0630708 100644 --- a/JOURNAL.md +++ b/JOURNAL.md @@ -1065,3 +1065,10 @@ With blocks of maxsize=512K it also hangs around ~57M. Maybe there is a problem in the memory segment? Can we reduce it to 1 GiB only and see if it has any effect? + + iter=289 nblocks=228 allocated=58636K (A) + iter=290 nblocks=227 allocated=58412K (D) + iter=291 nblocks=228 allocated=58480K (A) + iter=292 nblocks=229 allocated=58599K (A) + +Has changed, but not much. diff --git a/memtool.c b/memtool.c index 7dd347a..b718e63 100644 --- a/memtool.c +++ b/memtool.c @@ -33,6 +33,8 @@ allocate(void) size_t size = sizeof(struct block) + n * sizeof(uint32_t); + printf("allocating...\n"); + struct block *b = malloc(size); /* No mem */ @@ -43,6 +45,7 @@ allocate(void) b->next = NULL; /* Populate the block with some data */ + printf("filling...\n"); for (long i = 0; i < n; i++) b->data[i] = rand(); @@ -80,6 +83,7 @@ deallocate(void) nblocks--; nbytes -= b->size; + printf("deallocating...\n"); free(b); return 0;