added comments
This commit is contained in:
parent
44b6a96057
commit
99697d949e
3 changed files with 5 additions and 5 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/11/28 17:23:45 by thrieg #+# #+# */
|
/* Created: 2025/11/28 17:23:45 by thrieg #+# #+# */
|
||||||
/* Updated: 2025/12/08 14:22:46 by thrieg ### ########.fr */
|
/* Updated: 2025/12/08 15:52:17 by thrieg ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ int main(void)
|
||||||
free(c);
|
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);
|
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);
|
show_alloc_mem_ex(true);
|
||||||
|
|
||||||
a = malloc(20);
|
a = malloc(20);
|
||||||
b = malloc(1000);
|
b = malloc(1000);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/11/17 15:02:55 by thrieg #+# #+# */
|
/* Created: 2025/11/17 15:02:55 by thrieg #+# #+# */
|
||||||
/* Updated: 2025/12/08 15:37:27 by thrieg ### ########.fr */
|
/* Updated: 2025/12/08 16:02:22 by thrieg ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/11/25 11:47:23 by thrieg #+# #+# */
|
/* Created: 2025/11/25 11:47:23 by thrieg #+# #+# */
|
||||||
/* Updated: 2025/12/08 15:37:18 by thrieg ### ########.fr */
|
/* Updated: 2025/12/08 16:02:18 by thrieg ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ void *realloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
header->size = available_space;
|
header->size = available_space;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_mut);
|
pthread_mutex_unlock(&g_mut); // doesn't need to stay locked because the user is not supposed to free or realloc this ptr or change its content before this realloc returns
|
||||||
if (g_state.patern)
|
if (g_state.patern)
|
||||||
ft_memset((char *)ptr + original_space, g_state.patern, header->size - original_space); // should I use original_size to only perturb the actually requested bytes instead of the bytes I allocate?
|
ft_memset((char *)ptr + original_space, g_state.patern, header->size - original_space); // should I use original_size to only perturb the actually requested bytes instead of the bytes I allocate?
|
||||||
return (ptr);
|
return (ptr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue