in reply to Detecting memory leaks.

What convinced you the problem has to be a memory leak, as opposed to memory corruption? Could you try valgrind with --free-fill and --malloc-fill?

Did you run it under gdb to see where and how it faults? A SEGV could be something as simple as exceeding stack ulimit.

Replies are listed 'Best First'.
Re^2: Detecting memory leaks.
by Steve_BZ (Chaplain) on May 04, 2015 at 18:28 UTC

    Well, thanks for asking that question. It made me think. I guessed it might be a leak because the memory being utilised seemed to be increasing the longer I ran it, but in an unpredictable way.

    However, Valgrind gives the following, but it doesn't particularly seem to depend on any segment of code:

    ==2576== LEAK SUMMARY: ==2576== definitely lost: 731,689 bytes in 54,909 blocks ==2576== indirectly lost: 68,896 bytes in 2,326 blocks ==2576== possibly lost: 37,769,458 bytes in 52,844 blocks ==2576== still reachable: 78,109,700 bytes in 547,738 blocks ==2576== suppressed: 0 bytes in 0 blocks ==2576== Reachable blocks (those to which a pointer was found) are not + shown. ==2576== To see them, rerun with: --leak-check=full --show-leak-kinds= +all ==2576== ==2576== For counts of detected and suppressed errors, rerun with: -v ==2576== ERROR SUMMARY: 2610 errors from 2610 contexts (suppressed: 1 +from 1) image@iExam_SD_0003:~/Documents/Endoscopia$

    as it gives a similar dump to this even when I do ctrl-c immediately on start-up.

    Regards

    Steve