pb avec valgrind - C++ - Programmation
Marsh Posté le 29-03-2007 à 15:36:31
Petit up svp...
Y a pas d'utilisateurs de valgrind ici qui peuvent me dire s'ils ont déjà observé ce genre de comportement ?
Marsh Posté le 29-03-2007 à 16:59:17
Je viens de trouver un bug qui faisait sortir mes indices des limites dans certains cas. Je n'ai maintenant plus de problème (mêmes résultats avec valgrind qu'avec un lancement direct), mais je me demande toujours pourquoi le bug n'apparaissait qu'avec valgrind...
Marsh Posté le 29-03-2007 à 09:42:13
je rencontre un problème bizarre avec valgrind : j'ai l'impression que l'exécution de mon binaire ne se passe pas de la même manière lorsque je le lance seul, ou avec valgrind.
Voici le bout de code incriminé:
Lorsque j'exécute tout seul, tout se passe bien (en particulier, le assert() n'est pas rencontré):
~/Hough/trunk> ./hough
0.285 0.205 0.76969
Mais avec valgrind, tout se passe différemment:
~/Hough/trunk> valgrind ./hough
==4776== Memcheck, a memory error detector.
==4776== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==4776== Using LibVEX rev 1367, a library for dynamic binary translation.
==4776== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==4776== Using valgrind-3.0.1, a dynamic binary instrumentation framework.
==4776== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==4776== For more details, rerun with: -v
==4776==
==4776== Conditional jump or move depends on uninitialised value(s)
==4776== at 0x1B8F7B0F: index (in /lib/ld-2.4.so)
==4776==
==4776== Conditional jump or move depends on uninitialised value(s)
==4776== at 0x1B8F7B20: index (in /lib/ld-2.4.so)
i = 100 size = 100
j = 17 size = 200
k = 20 size = 100
hough: stdGrid.h:52: void stdGrid<Point, Position>::addPoint(int, int, int, Point) [with Point = stdPoint, Position = stdPosition]: Assertion `!"Indices out of bounds"' failed.
==4776==
==4776== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 25 from 4)
==4776== malloc/free: in use at exit: 8241200 bytes in 20101 blocks.
==4776== malloc/free: 20306 allocs, 205 frees, 8324578 bytes allocated.
==4776== For counts of detected errors, rerun with: -v
==4776== searching for pointers to 20101 not-freed blocks.
==4776== checked 8376368 bytes.
==4776==
==4776== LEAK SUMMARY:
==4776== definitely lost: 0 bytes in 0 blocks.
==4776== possibly lost: 0 bytes in 0 blocks.
==4776== still reachable: 8241200 bytes in 20101 blocks.
==4776== suppressed: 0 bytes in 0 blocks.
==4776== Reachable blocks (those to which a pointer was found) are not shown.
==4776== To see them, rerun with: --show-reachable=yes
zsh: abort valgrind ./hough
Je suis pas du tout spécialiste de valgrind, mais ça ne me paraît quand même pas bien normal...
---------------
TriScale innov