Search code examples
memory-leaksqnx

QNX: Detect memory leak in program


For: QNX Software Development Platform 6.5.0

I have run into a problem on a QNX 6.5.0 system where my program silently exists, and has been found to be due to a race condition similar to this post here: Thread stops randomly in the middle of a while loop

I have done some research and found that QNX has some built in tools to monitor memory and detect any leaks that are present in the program, however the instructions I have come across are for the QNX 6.5.0 IDE GUI, and I am running QNX on a server in command line.

example: http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.ide.userguide%2Ftopic%2Fmemory_DetecMemLeaks_.html

I'm kind of stuck with this as there isn't really a simple way to do this as the software designed is for logging purposes and is taking thousands of entries per second, and silently exists after a few hours. So I can't sit here waiting 2 hours each round.

Has anyone had experience with debugging mem leaks in QNX?

Edit: I am also using boost::lockfree::spsc_queue which may be causing the crash.


Solution

  • I was able to solve this by utilising Valgrind. I compiled my program and valgrind for linux and was able to debug my issue this way.