mfunyu / malloc

Find out the workings behind optimum memory management and recode it, as well as free and realloc.
2 stars 0 forks source link

[error] some addresses not recognized #60

Closed mfunyu closed 5 months ago

mfunyu commented 5 months ago
$> ./test/run.sh 10                                                           
[ RUN test no.10 ]
$> gcc -g -I includes -I libft -I ft_printf -I . ./test/single_test/test10.c -L. -lft_malloc -Llibft -lft -Lft_printf -lftprintf -o single_test
$> gcc -I includes -I libft -I ft_printf -I . ./test/single_test/test10.c -Llibft -lft -Lft_printf -lftprintf -o original
> executable 'original' created for compareson

===== test7 Freelists Test: mallocx2 -> free =====
Error: pointer being freed was not allocated
Error: pointer being freed was not allocated
Error: pointer being freed was not allocated
Error: pointer being freed was not allocated
Error: pointer being freed was not allocated
mfunyu commented 5 months ago

only occurs on bonus compilation (problem during consolidation?)

mfunyu commented 5 months ago
mfunyu commented 5 months ago
chunk = magazine->top;
    if (chunk && !IS_ALLOCED(chunk) && !IS_FOOTER(chunk))
    {
        if (CHUNKSIZE(chunk) >= chunk_size)
        {
            magazine->top = remaindering(chunk, chunk_size, magazine->type);
            if (!magazine->top)

crushing here in remindering, chunk is wrong,

mfunyu commented 5 months ago

invalid writing into magazine->top caused by invalide index -1