From: Yoshi R. <yo...@ro...> - 2011-10-18 13:29:44
|
Hey, i have a program that i expect to have a memory leak, thus i tried valgrind (for the first time). The version we use is 'Valgrind-3.6.1 and LibVEX' and my options were --leak-check=yes --track-origins=yes. The output (see below) suggests that i should consider informing you but my code is about 600 lines and i don't think i can shorten it very much (i could delete some functions i guess, but). The general thing is, that i have a look with functions in it that return pointer to arrays, at the end of each iteration these pointers are free'd. so something like: int *mk(const int *a) { r = malloc(...); ... return r; } int main(...) { ... for(i = ...) { x = mk(y); ... free(x); } ... } what do you think i should do? best regards, yoshi Memcheck, a memory error detector Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info Command: debug.6 station-area.real slide-angular-dist-np.arr bm-rank75.arr vex amd64->IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xB 0xC0 0xC valgrind: Unrecognised instruction at address 0x40a7f9. Your program just tried to execute an instruction that Valgrind did not recognise. There are two possible reasons for this. 1. Your program has a bug and erroneously jumped to a non-code location. If you are running Memcheck and you just saw a warning about a bad jump, it's probably your program's fault. 2. The instruction is legitimate but Valgrind doesn't handle it, i.e. it's Valgrind's fault. If you think this is the case or you are not sure, please let us know and we'll try to fix it. Either way, Valgrind will now raise a SIGILL signal which will probably kill your program. Process terminating with default action of signal 4 (SIGILL) Illegal opcode at address 0x40A7F9 at 0x40A7F9: nearbyint.N (in /home/aljoscha/spear/debug.6) HEAP SUMMARY: in use at exit: 62,997,368 bytes in 6 blocks total heap usage: 9 allocs, 3 frees, 62,999,072 bytes allocated LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks indirectly lost: 0 bytes in 0 blocks possibly lost: 0 bytes in 0 blocks still reachable: 62,997,368 bytes in 6 blocks suppressed: 0 bytes in 0 blocks Reachable blocks (those to which a pointer was found) are not shown. To see them, rerun with: --leak-check=full --show-reachable=yes For counts of detected and suppressed errors, rerun with: -v ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 8) |