valgrind

Memory leak reported by valgrind in dlopen?

I've been debugging some app lately with valgrind, and I'm getting very weird reports from dlopen. ==1987== 32 bytes in 1 blocks are still reachable in loss record 1 of 2 ==1987== at 0x4C24477: calloc (vg_replace_malloc.c:418) ==1987== by 0x570F31F: _dlerror_run (dlerror.c:142) ==1987== by 0x570EEE0: dlopen@@GLIBC_2.2.5 (dlopen...

Valgrind: Deliberately cause segfault

This is a mad-hack, but I am trying to deliberately cause a segfault at a particular point in execution, so valgrind will give me a stack trace. If there is a better way to do this please tell me, but I would still be curious to know how to deliberaly cause a segfault, and why my attempt didn't work. This is my failed attempt: long* p...

Is anyone using valgrind and Qt ?

I am trying to debug a large application build using Qt/C++ and valgrind is reporting a lot of memory leak from internal Qt stuff. Could anyone share a proper valgrind suppression file for Qt apps ? Thanks ! Eg. #include <qobject.h> int main() { QObject o; return 0; } returns: $ valgrind --leak-check=full --show-reachable=ye...

Valgrind Massif tool output graphical interface?

Hi, I'm using Valgrind 3.3.1 with the Massif tool to profile the heap of a C++ application, and I'm wondering if there is a graphical tool to examine the textual outputfile file. Thanks for any suggestion. ...

Compiling a binary to work with valgrind on Snow Leopard

I installed valgrind on Snow Leopard using the patch at https://bugs.kde.org/show%5Fbug.cgi?id=205241 . However, when I run it with a binary I compiled from C++ code, I'm told that valgrind "cannot execute binary file". What g++ flags should I set to make my program work with valgrind? ...

CppUnit leakage

Hi all, running my regression tests with valgrind I have this kind of report: ==20341== 256 bytes in 1 blocks are indirectly lost in loss record 915 of 919 ==20341== at 0x4A0661C: operator new(unsigned long) (vg_replace_malloc.c:...

Valgrind reports "Invalid free() / delete / delete[]" (C++)

I'm not sure what could be causing this. ==18270== Invalid free() / delete / delete[] ==18270== at 0x400576A: operator delete(void*) (vg_replace_malloc.c:342) ==18270== by 0x80537F7: LCD::LCDControl::~LCDControl() (LCDControl.cpp:23) ==18270== by 0x806C055: main (Main.cpp:22) ==18270== Address 0x59e92c4 is 388 bytes inside a b...

How does valgrind work?

Can someone provide a quick top level explanation of how valgrind works? ex. How does it know when memory is allocated and freed? ...

Confusing Valgrind output: indirectly lost blocks but no errors?

I'm running valgrind 3.5.0 to try and squash memory leaks in my program. I invoke it as so: valgrind --tool=memcheck --leak-check=yes --show-reachable=yes After my program finishes valgrind reports that ==22926== ==22926== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1) ==22926== malloc/free: in use at exit: 20,862 ...

how do i run valgrind to a process which has super user bit on?

I am running valgrind as follows:- /usr/local/bin/valgrind "process_name" After excecution its giving me following error ==21731== ==21731== Warning: Can't execute setuid/setgid executable: ==21731== Possible workaround: remove --trace-children=yes, if in effect ==21731== valgrind: "process name": Permission denied My valgrind per...

How to use the cachegrind output to optimize the application

I need to improve the throughput of the system. The usual cycle of optimization has been done and we have already achieved 1.5X better throughput. I am now beginning to wonder if I can utilize the cachegrind output to improve the system's throughput. Can somebody point me to how to begin on this? What I understand is we need to ensur...

kcachegrind for RHEL 5.1

I'm about to perform profiling to application. I have vagrind, but kcachegrind is not installed. Tryied to compile without success. Where it can be obtained from for RHEL 5.1? ...

Valgrind memcheck programmatic enable

I don't suppose there is a way to programmatically enable/disable Valgrind memcheck the way you can with callgrind? (Start/stop instrumentation). It's painfully, unusably slow (which is okay if the code you want to test starts automatically and you just leave it running), but I can't actually get into the code that's important without c...

Locate bad memory access on Solaris

On Linux, FreeBSD and other systems I have valgrind for checking for memory errors like invalid reads and similar. I really love valgrind. Now I have to test code on Solaris/OpenSolaris and can't find a way to get information on invalid reads/writes in an as nice way (or better ;-)) as valgrind there. When searching for this on the net ...

Measuring memory usage of a process on Linux

Hi I am trying to measure the memory usage of a process (a java program) on linux and have two questions related to that: I tried using the script ps_mem.py(sums values from /proc/$PID/smaps) and the peak of total memory usage was about 135MB (private and shared memory). The amount of shared memory is less than 1MB. Trying to use Valg...

valgrind report memory leak when assign a value to a string

Valgrind report memory leak when assign a value to a string I used this simple code to test an memory leak reported by valgrind. /****************************************** * FILE: t3.c * Compiled using : g++ -g t3.c -o t3 * * $ g++ -v * Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/specs * Configured with: ./configure --pre...

CUDA bounds checker?

Is there a tool equivalent to a bounds checker or purify or valgrind for CUDA? I'm basically looking for something that might tell me if I'm reading or writing outside of allocated memory. ...

Is there a way to do something to static members on process end?

I have a class that uses libxml2. It has static members which are used to hold context for a schema file and its parser. I'm using valgrind, and it's complaining that memory is not deallocated in connection with the schema context. This is because you need to free that memory yourself. However, since these context variables are stati...

Thread stack backtraces when program running under valgrind is interrupted

I have a server program, which doesn't have a very clean/graceful shutdown (not supposed to terminate in general). When tracing memory leaks, I run it under valgrind, but finally have to kill the process by a signal (^C). Generally I try to terminate the process when the ambiance is quiet but still then some threads might have been busy ...

Debugging a core produced by valgrind

Valgrind produced a vgcore.NNNN file -- how do I debug the core using GDB? Do I need to use the original executable and supply the core, or is there some other way to do it? Using valgrind as the root executable doesn't seem to work, and using the executable that was being run under valgrind directly in GDB with the core seems to produ...