changed the test cases for show_alloc_mem_ex

This commit is contained in:
Thomas Rieg 2025-11-28 20:03:03 +01:00
parent 42653de246
commit 0fd85cf568
3 changed files with 404 additions and 434 deletions

View file

@ -6,7 +6,7 @@
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/28 17:23:45 by thrieg #+# #+# */
/* Updated: 2025/11/28 19:16:24 by thrieg ### ########.fr */
/* Updated: 2025/11/28 20:02:06 by thrieg ### ########.fr */
/* */
/* ************************************************************************** */
@ -52,14 +52,17 @@ int main(void)
write(1, "\n\n\n\n\nafter allocating again: \n\n\n\n\n", sizeof("\n\n\n\n\nafter allocating again: \n\n\n\n\n") - 1);
show_alloc_mem_ex(false);
a = realloc(a, 420);
a = realloc(a, 420); // move the block
c = realloc(c, 504 * sizeof(int)); // expend
b = realloc(b, 400); // shrink
write(1, "\n\n\n\n\nafter realloc a: \n\n\n\n\n", sizeof("\n\n\n\n\nafter realloc a: \n\n\n\n\n") - 1);
write(1, "\n\n\n\n\nafter realloc: \n\n\n\n\n", sizeof("\n\n\n\n\nafter realloc: \n\n\n\n\n") - 1);
show_alloc_mem_ex(false);
free(a);
free(b);
free(c);
write(1, "\n\n\n\n\nafter free: \n\n\n\n\n", sizeof("\n\n\n\n\nafter free: \n\n\n\n\n") - 1);
show_alloc_mem_ex(false);
return (0);
}