|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#21 |
|
Senior Member
Iscritto dal: Oct 2004
Messaggi: 1945
|
Postali
|
|
|
|
|
|
#22 |
|
Senior Member
Iscritto dal: Oct 2006
Città: milano
Messaggi: 1439
|
Codice:
==4980== Memcheck, a memory error detector ==4980== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==4980== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==4980== Command: ./main ==4980== R R R R R R Autore No gia' presente R R R A 1 -> ==4980== Conditional jump or move depends on uninitialised value(s) ==4980== at 0x804A142: graph_print (graph.c:42) ==4980== by 0x8048727: main (main.c:40) ==4980== A Articolo 1 gia' presente A Autore Alloras inesistente A 2 -> 1 -> P ==4980== Invalid read of size 4 ==4980== at 0x8049E88: list_publication_author (util.c:423) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a2508 is 0 bytes inside a block of size 8 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x804933E: destroy_list (list.c:50) ==4980== by 0x8048768: main (main.c:44) ==4980== ==4980== Invalid read of size 1 ==4980== at 0x407BD6E: vfprintf (vfprintf.c:1620) ==4980== by 0x408389F: printf (printf.c:35) ==4980== by 0x8049E9A: list_publication_author (util.c:423) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a2540 is 0 bytes inside a block of size 4 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x8049333: destroy_list (list.c:49) ==4980== by 0x8048768: main (main.c:44) ==4980== ==4980== Invalid read of size 1 ==4980== at 0x40A3128: _IO_file_xsputn@@GLIBC_2.1 (fileops.c:1317) ==4980== by 0x407BC65: vfprintf (vfprintf.c:1620) ==4980== by 0x408389F: printf (printf.c:35) ==4980== by 0x8049E9A: list_publication_author (util.c:423) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a2542 is 2 bytes inside a block of size 4 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x8049333: destroy_list (list.c:49) ==4980== by 0x8048768: main (main.c:44) ==4980== ==4980== Invalid read of size 1 ==4980== at 0x40A313F: _IO_file_xsputn@@GLIBC_2.1 (fileops.c:1317) ==4980== by 0x407BC65: vfprintf (vfprintf.c:1620) ==4980== by 0x408389F: printf (printf.c:35) ==4980== by 0x8049E9A: list_publication_author (util.c:423) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a2541 is 1 bytes inside a block of size 4 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x8049333: destroy_list (list.c:49) ==4980== by 0x8048768: main (main.c:44) ==4980== ==4980== Invalid read of size 1 ==4980== at 0x40A30B0: _IO_file_xsputn@@GLIBC_2.1 (fileops.c:1349) ==4980== by 0x407BC65: vfprintf (vfprintf.c:1620) ==4980== by 0x408389F: printf (printf.c:35) ==4980== by 0x8049E9A: list_publication_author (util.c:423) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a2540 is 0 bytes inside a block of size 4 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x8049333: destroy_list (list.c:49) ==4980== by 0x8048768: main (main.c:44) ==4980== ==4980== Invalid read of size 1 ==4980== at 0x40A30BC: _IO_file_xsputn@@GLIBC_2.1 (fileops.c:1348) ==4980== by 0x407BC65: vfprintf (vfprintf.c:1620) ==4980== by 0x408389F: printf (printf.c:35) ==4980== by 0x8049E9A: list_publication_author (util.c:423) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a2542 is 2 bytes inside a block of size 4 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x8049333: destroy_list (list.c:49) ==4980== by 0x8048768: main (main.c:44) ==4980== ==4980== Invalid read of size 4 ==4980== at 0x8049E9E: list_publication_author (util.c:425) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a250c is 4 bytes inside a block of size 8 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x804933E: destroy_list (list.c:50) ==4980== by 0x8048768: main (main.c:44) ==4980== ==4980== Invalid read of size 4 ==4980== at 0x8049EC3: list_publication_author (util.c:430) ==4980== by 0x80487BF: main (main.c:52) ==4980== Address 0x41a250c is 4 bytes inside a block of size 8 free'd ==4980== at 0x4025BF0: free (vg_replace_malloc.c:366) ==4980== by 0x804933E: destroy_list (list.c:50) ==4980== by 0x8048768: main (main.c:44) ==4980== Boh & Icaro P Allora & No Alan Turing Allora Boh gino pino Icaro muimuimui No Zazza 1 2 ==4980== Conditional jump or move depends on uninitialised value(s) ==4980== at 0x804A196: graph_destroy (graph.c:62) ==4980== by 0x8048837: main (main.c:74) ==4980== ==4980== Conditional jump or move depends on uninitialised value(s) ==4980== at 0x4025BB0: free (vg_replace_malloc.c:366) ==4980== by 0x8049FDD: destroy_list_g (list_graph.c:51) ==4980== by 0x804A1A2: graph_destroy (graph.c:68) ==4980== by 0x8048837: main (main.c:74) ==4980== ==4980== Conditional jump or move depends on uninitialised value(s) ==4980== at 0x8049FC6: destroy_list_g (list_graph.c:46) ==4980== by 0x8049FF3: destroy_list_g (list_graph.c:54) ==4980== by 0x804A1A2: graph_destroy (graph.c:68) ==4980== by 0x8048837: main (main.c:74) ==4980== ==4980== ==4980== HEAP SUMMARY: ==4980== in use at exit: 28 bytes in 4 blocks ==4980== total heap usage: 421 allocs, 417 frees, 2,627 bytes allocated ==4980== ==4980== 28 (12 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3 ==4980== at 0x4026864: malloc (vg_replace_malloc.c:236) ==4980== by 0x8049EF9: add_to_list_g (list_graph.c:8) ==4980== by 0x804A060: graph_vertexinsert (graph.c:21) ==4980== by 0x8049CF9: add_publication_id (util.c:362) ==4980== by 0x804871B: main (main.c:39) ==4980== ==4980== LEAK SUMMARY: ==4980== definitely lost: 12 bytes in 1 blocks ==4980== indirectly lost: 16 bytes in 3 blocks ==4980== possibly lost: 0 bytes in 0 blocks ==4980== still reachable: 0 bytes in 0 blocks ==4980== suppressed: 0 bytes in 0 blocks ==4980== ==4980== For counts of detected and suppressed errors, rerun with: -v ==4980== Use --track-origins=yes to see where uninitialised values come from ==4980== ERROR SUMMARY: 70 errors from 13 contexts (suppressed: 11 from 6) |
|
|
|
|
|
#23 |
|
Senior Member
Iscritto dal: Oct 2004
Messaggi: 1945
|
Con uno sguardo veloce sembra che tu stia leggendo dei blocchi di memoria liberati con free
|
|
|
|
|
|
#24 |
|
Senior Member
Iscritto dal: Oct 2006
Città: milano
Messaggi: 1439
|
Di sicuro ho errori sulle strutture dati a questo punto o non si riprodurrebbero esponenzialmente
|
|
|
|
|
|
#25 |
|
Senior Member
Iscritto dal: Jan 2007
Messaggi: 2267
|
Se hai problemi con allocazione e successiva pulizia della memoria prova ad usare i puntatori smart. Dovrai però passare al C++.
__________________
Concluso con:... |
|
|
|
|
|
#26 |
|
Senior Member
Iscritto dal: Oct 2006
Città: milano
Messaggi: 1439
|
Niente C++, è da svolgere in ansi C.
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 14:13.



















