I've encountered a bug in my Gtkmm-3.0 application that seems to be memory related from my quick google search, but I've been unable to tease out a possible cause. The application will fail at random, and I've removed all the code that gets updated during each call to signal_timeout() with no effect. It doesn't seem to be related to key/button presses either.
Valgrind has been less than helpful since the GUI takes ages to spin up. Any advice from either a Gtk/Glib user, or someone who's run into this error before would be greatly appreciated. Below is the stack trace from my most recent core file.
(gdb) bt
#0 0x00007f4b5de27720 in magazine_cache_push_magazine () at /lib64/libglib-2.0.so.0
#1 0x00007f4b5de278e2 in private_thread_memory_cleanup () at /lib64/libglib-2.0.so.0
#2 0x00007f4b5a6b6c22 in __nptl_deallocate_tsd () at /lib64/libpthread.so.0
#3 0x00007f4b5a6b6e33 in start_thread () at /lib64/libpthread.so.0
#4 0x00007f4b5cabf34d in clone () at /lib64/libc.so.6
It’s almost certainly a heap corruption bug in your application or one of the libraries it uses, rather than a bug in GLib. The only real way to debug these issues is using Valgrind. Make sure you run it with G_SLICE=always-malloc
set in the environment, as that will disable GSlice and use malloc()
instead, which Valgrind can instrument better.
If Valgrind really won’t work for your application, you could try the simpler glibc heap consistency checks, enabled by setting MALLOC_CHECK_=1
in the environment: https://www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html#Heap-Consistency-Checking