I can't figure out where an error is coming from. I'm stuck writing my program getting that error:
Quote:
*** glibc detected *** free(): invalid pointer: 0x0804b410 ***
Aborted
|
I tried to get some more clues about this passing the whole thing to valgrind:
Code:
==10868== Invalid write of size 4
==10868== at 0x804961B: deltaWjkMod (neurone.c:206)
==10868== by 0x8048B66: main (main.c:67)
==10868== Address 0x1BCD1074 is 0 bytes after a block of size 12 alloc'd
==10868== at 0x1B8FFB95: calloc (vg_replace_malloc.c:279)
==10868== by 0x8048C3F: wmatriceCreer (neurone.c:27)
==10868== by 0x80489A8: main (main.c:23)
==10868==
==10868== Invalid free() / delete / delete[]
==10868== at 0x1B8FF3D0: free (vg_replace_malloc.c:235)
==10868== by 0x1BAACB7B: free_mem (in /lib/libc-2.3.4.so)
==10868== by 0x1BAAC7D4: __libc_freeres (in /lib/libc-2.3.4.so)
==10868== by 0x1B8FB6E0: _vgw_freeres (vg_preloaded.c:62)
==10868== by 0x1B9E2585: exit (in /lib/libc-2.3.4.so)
==10868== by 0x1B9CC470: __libc_start_main (in /lib/libc-2.3.4.so)
==10868== by 0x80488C0: ??? (start.S:119)
==10868== Address 0x1B913C90 is not stack'd, malloc'd or (recently) free'd
==10868==
==10868== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 42 from 3)
==10868== malloc/free: in use at exit: 0 bytes in 0 blocks.
==10868== malloc/free: 15 allocs, 16 frees, 136 bytes allocated.
==10868== For counts of detected errors, rerun with: -v
==10868== No malloc'd blocks -- no leaks are possible.
As far as GDB is concerned, I don't get much more information:
Code:
Program received signal SIGABRT, Aborted.
0x400f4ef1 in kill () from /lib/libc.so.6
The line (206) reported by valgrind is the following:
Code:
net->wjk->wMatrice[k][i] = (net->n) * (net->cachee->delta[i]);
Inside a small function:
Code:
void
deltaWjkMod (struct reseau *net)
{
int i, k;
for (i = 0; i < net->nCachee + 1; i++)
for (k = 0; k < net->nEntree + 1; k++)
net->wjk->wMatrice[k][i] = (net->n) * (net->cachee->delta[i]);
}
What's going wrong here ? I can understand what that error could mean but I can't see what I'm not doing right.
The source code can be seen here:
http://pierreluc.aqra.ca/projet/BackPropNN/