Posts: 44
Joined: Sat Feb 25, 2017 10:11 pm

Guidance debugging GTK-3 Application

Mon Dec 31, 2018 2:51 pm

I need some guidance on how to go about debugging a GTK application I have been working on.

It is a graphical front end to an Arduino that is collecting data (primarily from a GPS) and then displaying it with the GTK widgets. It is a project that I work on part time at the weekends, has been under development for over a year and is now thousands of lines of code... I say that to head off the suggestion to post the code to the forum!

The code appears to work functionally. In that the data is displayed and I can interact with the controls and get the expected results. However when I leave the Pi running for hours or overnight I seem to have developed a couple of different undesirable outcomes.

The first that I noticed is that when I wake up the screensaver, the GUI does not redraw the application window and the processor usage shows 25%+ continually. I'm "assuming" that somehow the code has got in to a loop that is never dropping out to check user or system events. If I kill the process, it will start up and run again.

A second malfunction is that it I leave it running, I come back and find that the terminal that it was running in ends with the message "Killed". Not a segment fault (with is my usual code screw-up) and no core dump. The "killed" message is not one that is coded in to the application so again I'm "assuming" that the kernel decided to kill it for some reason.

As these faults occur after many hours of running and I have never noticed them while playing with the application I am at a loss as how to go about finding the fault. I expect that it was something that I did, because it has not always acted like this but I don't even know how far back I need to go to get to code that doesn't do this.

I have considered logging events in to a log file to see if I can determine which function I was in just before the program hung, but as it runs for hours, that would produce huge files & many writes to the SD card. That may be where I end up having to go, but I wanted to see if there were any other ideas that y'all could offer.

Best regards


Posts: 45
Joined: Thu Jun 09, 2016 4:11 am

Re: Guidance debugging GTK-3 Application

Wed Jan 02, 2019 3:51 am

Sounds like a memory leak.

Posts: 44
Joined: Sat Feb 25, 2017 10:11 pm

Re: Guidance debugging GTK-3 Application

Wed Jan 02, 2019 3:55 am

Could be, suggestions for finding it?

Return to “Graphics programming”