valgrind

What tools do you use to develop C++ applications on Linux?

I develop C++ applications in a Linux environment. The tools I use every day include Eclipse with the CDT plugin, gdb and valgrind. What tools do other people use? Is there anything out there for Linux that rivals the slickness of Microsoft Visual Studio? ...

How to check for memory leaks in Guile extension modules?

I develop an extension module for Guile, written in C. This extension module embeds a Python interpreter. Since this extension module invokes the Python interpreter, I need to verify that it properly manages the memory occupied by Python objects. I found that the Python interpreter is well-behaved in its own memory handling, so that...

Running Eclipse under Valgrind

Has anybody here succeeded in running Eclipse under Valgrind? I'm battling a particularly hairy crash involving JNI code, and was hoping that Valgrind perhaps could (again) prove its excellence, but when I run Eclipse under Valgrind, the JVM terminates with an error message about not being able to create the initial object heap (I curren...

Outputting to stderr whenever malloc/free is called

With Linux/GCC/C++, I'd like to record something to stderr whenever malloc/free/new/delete are called. I'm trying to understand a library's memory allocations, and so I'd like to generate this output while I'm running unit tests. I use valgrind for mem leak detection, but I can't find an option to make it just log allocations. Any i...

How do I tell valgrind to memcheck forked processes?

I have a process x that I want to check for leaks with valgrind. The problem is that x is run by y, and y in turn is run by z. I can't run x standalone because y and z setup the environment for x, such as environment variables, command line switches, files needed by x etc. Is there any way I can tell valgrind to run on z but to fol...

How detect whether running under valgrind in make file or shell script?

I need to detect whether my Makefile is running under valgrind (indirectly, using valgrind --trace-children=yes), I know how to do it from C but I have not found a way to do it from a script, The earlier answers works on Linux only. For Mac OS X I am an going to grep for VALGRIND_STARTUP_PWD in the environment, unless someone has a bet...

How to Learn C Debugging and Best Practices

I've written an Apache module in C. Under certain conditions, I can get it to segfault, but I have no idea as to why. At this point, it could be my code, it could be the way I'm compiling the program, or it could be a bug in the OS library (the segfault happens during a call to dlopen()). I've tried running through GDB and Valgrind with...

How can I detect if a program is running from within valgrind?

Is there a way to identify at run-time of an executable is being run from within valgrind? I have a set of C++ unit tests, and one of them expects std::vector::reserve to throw std::bad_alloc. When I run this under valgrind, it bails out completely, preventing me from testing for both memory leaks (using valgrind) and behavior (expecti...

Is there a good Valgrind substitute for Windows?

I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux - I have no other need or interest in moving my OS to Linux so I was wondering if there is a equally good program for Windows. ...

Running a JNI application in the Sun VM under Valgrind

The sun JVM spits out a LOT of extra noise when run under valgrind, which makes tracking memory problems in the application very challenging. I'd like to find either a suppression file, or a VM runtime mode, that will strip out spurious memory errors in order to separate the wheat from the chaff in this situation. Any suggestions? ...

Is it overkill to run the unit test with Valgrind?

Hi Just some days ago I started looking into a unit test framework called check, and I intend to run the test on c code under Linux. Now check and some well designed code and some test code can help me to verify that the basic functionality is correct, I mean it is quite easy to just look at the variables in and response back and ...

openssl / valgrind

I have an application that has to calculate the MD5 of file, I have used the openssl library, valgrind complains about some blocks still reachable. Compile the following code: #include <openssl/bio.h> int main(int, char**) { BIO * mem = BIO_new(BIO_s_mem()); BIO_vfree(mem); return 0; } the run it using valgrind this is what...

How do I debug while running my program in Valgrind?

I was finishing up a code mod and wanted to run my program through Valgrind to make sure I've got all memory accounted for, but my program failed an assertion that doesn't fail when running on its own. Is it possible to stop in the debugger while running from Valgrind? I'm currently wading through the manual, but figured I could get my...

Favorite Valgrind Options

I usually use this: valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./mycode But not sure if on one hand it checks everything, on the other hand too verbose. What's your favorite option? ...

Should I worry about "Conditional jump or move depends on uninitialised value(s)"?

If you've used Memcheck (from Valgrind) you'll probably be familiar with this message... Conditional jump or move depends on uninitialized value(s) I've read about this and it simply occurs when you use an uninitialized value. MyClass s; s.DoStuff(); This will work because s is automatically initialized... So if this is the case...

Why is Valgrind stating that my implementation of std::map<T, T> produces a memory leak?

Valgrind is outputting the following: ==14446== 2,976 (176 direct, 2,800 indirect) bytes in 2 blocks are definitely lost in loss record 23 of 33 ==14446== at 0x4C2506C: operator new(unsigned long) (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so) ==14446== by 0x41C487: __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair...

Why does Valgrind not like my usage of glutCreateWindow?

I'm using the following code... 169: const char *title = Title.c_str(); 170: glutCreateWindow(title); ... Valgrind gives me the following ... ==28841== Conditional jump or move depends on uninitialised value(s) ==28841== at 0x6FF7A4C: (within /usr/lib64/libGLcore.so.180.44) ==28841== by 0x6FF81F7: (within /usr/lib64/libGLcore.s...

Are there known false positives issues with Valgrind?

Hello, Are there any known false positives with Valgrind? (myself I get a 'Conditional jump or move depends on uninitialised value(s)' with the 'fmemopen' function, writing in 'c' and gcc, can I be sure it's real?) EDIT: are there known issues that are not in the suppression files? Are there some things one can do in a program, that ...

Windows Callgrind results browser, alternative to KCacheGrind

Is there any tool, other than KCacheGrind, being able to view callgrind results? Preferably for Windows platform? ...

Valgrind automatic tests -- are they used somewhere?

Do you think that running set of automatic tests based on valgrind's tool suite makes sense? Did you hear about or see such setup in action? What automatic (free from human intuition) actions could such setup perform? ...