I am trying to debug memory problems with my program, however the error messages that are coming out of valgrind are unhelpful. Here is an example.
==3944334== 184 bytes in 1 blocks are possibly lost in loss record 224 of 239==3944334== at 0x483BD7B: realloc (vg_replace_malloc.c:836)==3944334== by 0x5675928: g_realloc (in /usr/lib/libglib-2.0.so.0.6400.2)==3944334== by 0x55CD2E5: ??? (in /usr/lib/libgobject-2.0.so.0.6400.2)==3944334== by 0x55C8D4C: g_type_register_static (in /usr/lib/libgobject-2.0.so.0.6400.2)==3944334== by 0x55E0EF2: g_param_type_register_static (in /usr/lib/libgobject-2.0.so.0.6400.2)==3944334== by 0x55C1977: ??? (in /usr/lib/libgobject-2.0.so.0.6400.2)==3944334== by 0x55BFB4C: ??? (in /usr/lib/libgobject-2.0.so.0.6400.2)==3944334== by 0x4011099: call_init.part.0 (in /usr/lib/ld-2.31.so)==3944334== by 0x40111A0: _dl_init (in /usr/lib/ld-2.31.so)==3944334== by 0x4002139: ??? (in /usr/lib/ld-2.31.so)==3944334== by 0x2: ???==3944334== by 0x1FFF0002DA: ???
I want to know if these errors are a problem. If they are I want to know how to solve them, if they aren't I want to know how to suppress them.
Usually if I encounter an error in valgrind I can find a function name I recognize and a line number and solve the error from there. However in this case there is not a single function name I recognize as mine across all the errors. Here is how I'm running valgrind.
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./logdraw -f log.txt
And here is the valgrind summary.
==3944839== LEAK SUMMARY:==3944839== definitely lost: 0 bytes in 0 blocks==3944839== indirectly lost: 0 bytes in 0 blocks==3944839== possibly lost: 1,352 bytes in 18 blocks==3944839== still reachable: 47,893 bytes in 221 blocks==3944839== of which reachable via heuristic:==3944839== newarray : 1,536 bytes in 16 blocks==3944839== suppressed: 0 bytes in 0 blocks==3944839== ==3944839== ERROR SUMMARY: 18 errors from 18 contexts (suppressed: 0 from 0)
To complicate matters further I can put "return 0;" as the first line in my main function and still get back all of these errors when running valgrind. I thought I could triangulate the problem using that but apparently I cannot.
Here is my makefile, if it matters.
logdraw: log.o gtkUI.o gcc `pkg-config --cflags gtk+-3.0` -g -Wall -o logdraw logdraw.o gtkUI.o `pkg-config --libs gtk+-3.0`log.o: logdraw.c gtkUI.h gcc `pkg-config --cflags gtk+-3.0` -g -Wall -c logdraw.c `pkg-config --libs gtk+-3.0` -O0 -I.gtkUI.o: gtkUI.c gtkUI.h gcc `pkg-config --cflags gtk+-3.0` -g -Wall -c gtkUI.c `pkg-config --libs gtk+-3.0`
I know there is some memory weirdness in gtk3 so I have commented out the call I made to the functions in my gtkUI.c file as well as the #include
for that file. I don't know if it could still be affecting me.