zen debian Desktop cat test include glib int main int argc char argv g

 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
46
47
48
49
50
51
52
53
54
55
56
zen@debian:~/Desktop$ cat test.c
#include <glib.h>
int
main( int argc,
char **argv )
{
gchar **test = NULL;
test = g_strsplit( "some,text", ",", 0 );
g_printf( "%s\n", test[0] );
g_free( test );
return 0;
}
zen@debian:~/Desktop$ gcc -o test test.c $(pkg-config --cflags --libs glib-2.0) && valgrind --leak-check=full --show-reachable=no ./test
==6259== Memcheck, a memory error detector
==6259== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==6259== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==6259== Command: ./test
==6259==
some
==6259==
==6259== HEAP SUMMARY:
==6259== in use at exit: 4,130 bytes in 14 blocks
==6259== total heap usage: 15 allocs, 1 frees, 4,142 bytes allocated
==6259==
==6259== 5 bytes in 1 blocks are definitely lost in loss record 2 of 12
==6259== at 0x4028308: malloc (vg_replace_malloc.c:263)
==6259== by 0x409942A: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x40997A2: g_malloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x40B05A4: g_strndup (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x40B1CB8: g_strsplit (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x80485F8: main (in /home/zen/Desktop/test)
==6259==
==6259== 5 bytes in 1 blocks are definitely lost in loss record 3 of 12
==6259== at 0x4028308: malloc (vg_replace_malloc.c:263)
==6259== by 0x409942A: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x40997A2: g_malloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x40B04C8: g_strdup (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x40B1D56: g_strsplit (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4)
==6259== by 0x80485F8: main (in /home/zen/Desktop/test)
==6259==
==6259== LEAK SUMMARY:
==6259== definitely lost: 10 bytes in 2 blocks
==6259== indirectly lost: 0 bytes in 0 blocks
==6259== possibly lost: 0 bytes in 0 blocks
==6259== still reachable: 4,120 bytes in 12 blocks
==6259== suppressed: 0 bytes in 0 blocks
==6259== Reachable blocks (those to which a pointer was found) are not shown.
==6259== To see them, rerun with: --leak-check=full --show-reachable=yes
==6259==
==6259== For counts of detected and suppressed errors, rerun with: -v
==6259== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 19 from 6)
zen@debian:~/Desktop$