debug memory leaks on linux - linux

I've got an application that was compiled without debugging information and I need to check memory leaks. Is there any way to do it in linux like I can do it in solaris with mdb + umem?

Sure. Run it with valgrind (valgrind yourexecutable).

Related

Valgrind App crash due to Kernel panic Error while accessing external DDR memory

I am running one application on linux with valgrind on my custom hardware ARM architecture board, which access external DDR memory (not present on board) causing application to crash with following reason
Bad mode in Error handler detected on CPU3. code 0xbf000002 -- SError
Kernel Panic- not synching bad mode
I dont see this problem when application tries to access on board local DDR memory.I dont see same problem with other memory leak tools like dmalloc or address sanitizer.
is this there any known problem and solution for this issue ?
not sure if I have given complete info let me know if you need more details.
Thanks in advance for you time & effort.
I was using valgrind memcheck tool to report memory leak issues from my application.

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.
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.

High CPU usage using Lauterbach T32 with Linux/Qt

I'm experiencing a very high CPU usage (~100%) using the Qt version of T32 on Linux, even when the program is waiting user interaction. The executable is t32marm-qt.
This does not happen when I use the standard Tcl-based t32marm executable.
A strace shows that the executable continuosly cycles on the
clock_gettime(CLOCK_REALTIME,...)
syscall.
The Linux distribution is Mint 14 32-bit (derivation of Ubuntu 12.10).
Has anybody experienced this behavior ?
If so, is it a bug or just a wrong configuration ?
Yes, I have been just confirmed that it is a software bug, fixed in more recent versions of the tool. If you encounter such a problem, update your version.

Make gdb use less memory

gdb uses way too much memory on my Linux machine - I've allocated 2GB to this LXC virtual machine, but that's not enough.
Is there anything I can do apart from selectively uninstalling -debuginfo packages, which will effectively blind me if a problem turns out to involve those packages?
This was due to an issue in a CVS version of gdb. Downgrading gdb solved it.

Any tool other than Valgrind to monitor memory usage for running processes in Linux?

This answer to this question says that there's no way to attach Valgrind to an already running process.
Are there any other tools for Linux that can report on memory usage but can attach to a process that's already running?
You can use tools like pmap or ps_mem.py to get more details about the memory use of running processes than you get from top. You won't get all the fancy features from Valgrind like detecting memory leaks and such.
All app data should be in
/proc/<PID>/

Resources