bonjour,
voila, je cherche un outils qui me permettrait de dire si j'ai des fuites de memoires dans un programme. ?? on m'a diqu'il en xistait un, mais j'ai pas trouvé.
merci
a++
bonjour,
voila, je cherche un outils qui me permettrait de dire si j'ai des fuites de memoires dans un programme. ?? on m'a diqu'il en xistait un, mais j'ai pas trouvé.
merci
a++
Valgrind
http://valgrind.org/
heu grand merci
maisq il me met ca comme erreurj'ai pas acces moi a
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 g++ -o Brainiac Brain.o brainiac.o Engine.o Font.o Global.o Pix.o `sdl-config --libs` -Wall -ansi -g -lSDL_image Brainiac elekis@ubuntu:~/game/Brainiac/src$ val valgrind valgrind.bin valgrind-listener validlocale elekis@ubuntu:~/game/Brainiac/src$ valgrind --leak-check=yes Brainiac ==9310== Memcheck, a memory error detector for x86-linux. ==9310== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al. ==9310== Using valgrind-2.2.0, a program supervision framework for x86-linux. ==9310== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al. ==9310== For more details, rerun with: -v ==9310== ==9310== Syscall param write(buf) contains uninitialised or unaddressable byte(s) ==9310== at 0x1B8E4C02: (within /lib/ld-2.3.2.so) ==9310== by 0x1BC79FFE: (within /usr/X11R6/lib/libX11.so.6.2) ==9310== by 0x1BC7ACF4: _X11TransWrite (in /usr/X11R6/lib/libX11.so.6.2) ==9310== by 0x1BC5B4B4: (within /usr/X11R6/lib/libX11.so.6.2) ==9310== Address 0x1BDAB6AE is 14 bytes inside a block of size 16384 alloc'd ==9310== at 0x1B905901: calloc (vg_replace_malloc.c:176) ==9310== by 0x1BC4DD84: XOpenDisplay (in /usr/X11R6/lib/libX11.so.6.2) ==9310== by 0x1B9531D8: (within /usr/lib/libSDL-1.2.so.0.7.1) ==9310== by 0x1B948ACC: SDL_VideoInit (in /usr/lib/libSDL-1.2.so.0.7.1) ==9310== ==9310== ERROR SUMMARY: 2391 errors from 1 contexts (suppressed: 43 from 1) ==9310== malloc/free: in use at exit: 23022 bytes in 304 blocks. ==9310== malloc/free: 1273 allocs, 969 frees, 1564572 bytes allocated. ==9310== For counts of detected errors, rerun with: -v ==9310== searching for pointers to 304 not-freed blocks. ==9310== checked 4935568 bytes. ==9310== ==9310== ==9310== 8 bytes in 1 blocks are definitely lost in loss record 1 of 27 ==9310== at 0x1B9059FF: realloc (vg_replace_malloc.c:197) ==9310== by 0x1BC9B259: (within /usr/X11R6/lib/libX11.so.6.2) ==9310== by 0x1BC9C8AB: (within /usr/X11R6/lib/libX11.so.6.2) ==9310== by 0x1BC9D6E1: (within /usr/X11R6/lib/libX11.so.6.2) ==9310== ==9310== LEAK SUMMARY: ==9310== definitely lost: 8 bytes in 1 blocks. ==9310== possibly lost: 0 bytes in 0 blocks. ==9310== still reachable: 22814 bytes in 302 blocks. ==9310== suppressed: 200 bytes in 1 blocks. ==9310== Reachable blocks (those to which a pointer was found) are not shown. ==9310== To see them, rerun with: --show-reachable=yes elekis@ubuntu:~/game/Brainiac/src$
vg_replace_malloc.c:197
/usr/X11R6/lib/libX11.so.6.2
/usr/X11R6/lib/libX11.so.6.2
(within /usr/X11R6/lib/libX11.so.6.2
est ce normal???
merci
a+
Oui, tu peux te permettre d'ignorer les messages qui ne sont pas relie a ton programme. Valgrind evalue le binaire, incluant toutes les lib qu'il utilise, a mesure qu'il fonctionne. Il se peux qu'il detecte des anomalies (reelles ou non) dans les librairies systemes.
Si tu veux un outil graphique pour afficher les resultats, regarde pour alleyoop
Partager