Bonjour a tous,
J'essaie d'implementer un algorithme de tri sur mon ordinateur linux. J'ai un message d'erreur que je ne comprends pas. Je le poste sur le forum linux car mon algorithme a l'air de fonctionner : il ne trie pas mais la fonction de tri quitte normalememt sans erreur, la premiere ligne est issu d'un printf invoque apres ma fonction de tri:
Lorsque j'execute le binaire, j'obtiens le message suivant ? Pouvez m'eclairer quant a la signification de ce message ? Merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 void ft_test_libqsort(void *tab, int n) { int *tab2; clock_t start, end; tab2 = malloc(n * sizeof(int)); memcpy(tab2, tab, n * sizeof(int)); start = clock(); mysort(tab2, n, sizeof(int), f_cmp_int); end = clock(); printf("time libqsort : %.2f", (end - start)/(double)CLOCKS_PER_SEC); ft_check_result(tab2, n); free(tab2); }
time quicksort : 0.00-------NOT SORTED---------
*** Error in `./a.out': double free or corruption (out): 0x0000000001710030 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80996)[0x7f86b1122996]
./a.out[0x400a4c]
./a.out[0x400b6f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f86b10c3de5]
./a.out[0x400799]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:01 4983886 /home/gautier/etude/sorting_algo/a.out
00601000-00602000 r--p 00001000 08:01 4983886 /home/gautier/etude/sorting_algo/a.out
00602000-00603000 rw-p 00002000 08:01 4983886 /home/gautier/etude/sorting_algo/a.out
01710000-01731000 rw-p 00000000 00:00 0 [heap]
7f86b0e8c000-7f86b0ea1000 r-xp 00000000 08:01 1703941 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f86b0ea1000-7f86b10a0000 ---p 00015000 08:01 1703941 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f86b10a0000-7f86b10a1000 r--p 00014000 08:01 1703941 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f86b10a1000-7f86b10a2000 rw-p 00015000 08:01 1703941 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f86b10a2000-7f86b125f000 r-xp 00000000 08:01 1707870 /lib/x86_64-linux-gnu/libc-2.17.so
7f86b125f000-7f86b145f000 ---p 001bd000 08:01 1707870 /lib/x86_64-linux-gnu/libc-2.17.so
7f86b145f000-7f86b1463000 r--p 001bd000 08:01 1707870 /lib/x86_64-linux-gnu/libc-2.17.so
7f86b1463000-7f86b1465000 rw-p 001c1000 08:01 1707870 /lib/x86_64-linux-gnu/libc-2.17.so
7f86b1465000-7f86b146a000 rw-p 00000000 00:00 0
7f86b146a000-7f86b148d000 r-xp 00000000 08:01 1707846 /lib/x86_64-linux-gnu/ld-2.17.so
7f86b166b000-7f86b166e000 rw-p 00000000 00:00 0
7f86b1688000-7f86b168c000 rw-p 00000000 00:00 0
7f86b168c000-7f86b168d000 r--p 00022000 08:01 1707846 /lib/x86_64-linux-gnu/ld-2.17.so
7f86b168d000-7f86b168f000 rw-p 00023000 08:01 1707846 /lib/x86_64-linux-gnu/ld-2.17.so
7fffadcd0000-7fffadcf1000 rw-p 00000000 00:00 0 [stack]
7fffadda8000-7fffaddaa000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)
Partager