# Debug using Valgrind The Valgrind tool helps detect memory-related errors that are common in C and C++ programs. These errors can lead to crashes and unpredictable behavior, such as memory leaks and memory corruption. By default, the build includes the Valgrind tool. ## Prerequisite Set up SSH. For instructions, see [Sign in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-80022-254/how_to.html#use-ssh). ## Debug with Valgrind 1. Push debug symbols to the device. For instructions, see [Configure debug symbols](https://docs.qualcomm.com/doc/80-80022-12/topic/debug_symbols.html#debug-symbols). 2. Run the following Valgrind command on the device: valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes /usr/bin/tqftpserv Copy to clipboard **Sample output:** ==622== Memcheck, a memory error detector ==622== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==622== Command: /usr/bin/tqftpserv ==622== ^C==622== ==622== Process terminating with default action of signal 2 (SIGINT) ==622== at 0x498EF38: select (select.c:69) ==622== by 0x4013CB: ??? (in /usr/bin/tqftpserv) ==622== by 0x48DB1AF: (below main) (libc\_start\_call\_main.h:58) ==622== ==622== FILE DESCRIPTORS: 4 open (3 std) at exit. ==622== Open pf-42 socket 3: ==622== at 0x49984CC: socket (syscall-template.S:120) ==622== by 0x4891293: qrtr\_open (in /usr/lib/libqrtr.so.1.0) ==622== by 0x40129B: ??? (in /usr/bin/tqftpserv) ==622== by 0x48DB1AF: (below main) (libc\_start\_call\_main.h:58) ==622== ==622== ==622== HEAP SUMMARY: ==622== in use at exit: 0 bytes in 0 blocks ==622== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==622== ==622== All heap blocks were freed -- no leaks are possible ==622== ==622== For lists of detected and suppressed errors, rerun with: -s ==622== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==622== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) For more information, see [Valgrind](https://valgrind.org/). Last Published: May 14, 2026 [Previous Topic Debug using strace](https://docs.qualcomm.com/bundle/publicresource/80-80022-12/topics/debug_with_strace.md) [Next Topic Debug using GNU debugger](https://docs.qualcomm.com/bundle/publicresource/80-80022-12/topics/debug_using_gdb.md)