Add debug in memtool to see where it hangs

This commit is contained in:
Rodrigo Arias 2024-07-09 22:12:55 +02:00
parent 6b3af5b188
commit 6c8d6354bc
2 changed files with 11 additions and 0 deletions

View File

@ -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.

View File

@ -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;