valgrind

Analyze with valgrind only some functions and subfunctions

Hi, I want to debug a "big" C code, and use valgrind, in particular the tool memcheck. The output is very long, due to the size of the program, and I only want to focus on some function and relative subfunctions of the program. Is it possible in valgrind only to analyze certain function and subfunctions (up to some depth level)? Thanks...

cannot free memory

Hello, gcc 4.4.4 c89 I have the following function but I cannot free the memory. The message I get in Valgrind is suspecting the getline function. However, I am free the file pointer at the end of the function. So it cannot be that. I have a global array of pointers to char 'candidate_names'. However, I haven't allocated any memory f...

Any references on Dynamic Code Analysis?

Yesterday I was reading about debugging techniques and found Valgrind to be really interesting. It seems to use techniques from dynamic code analysis. And I followed a link from the original reference to something else called Path Profiling. I tried Googling but I guess I am using the wrong terms to search for a good reference on these ...

Valgrind errors

I have recently developed a habit of running all of my programs through valgrind to check for memory leaks, but most of its results have been a bit cryptic for me. For my latest run, valgrind -v gave me: All heap blocks were freed -- no leaks are possible That means my program's covered for memory leaks, right? So what does this err...

valgrind conditional jump or move depends on uninitialised value

I want to fix problem reported by valgrind: ==7182== Conditional jump or move depends on uninitialised value(s) ==7182== at 0x40EC75C: strstr (in /lib/libc-2.9.so) ==7182== by 0x804A977: search_graph_begin (compression.c:462) ==7182== by 0x804AB60: search_graph_end (compression.c:497) ==7182== by 0x804AA97: search_graph_be...

Still Reachable Leak detected by Valgrind

All the functions mentioned in this block are library functions. How can I rectify this memory leak? It is listed under the "Still reachable" category. (There are 4 more, which are very similar, but of varying sizes) 630 bytes in 1 blocks are still reachable in loss record 5 of 5 at 0x4004F1B: calloc (vg_replace_malloc.c:418) ...

Test for void pointer in C++ before deleting

I have an array in C++: Player ** playerArray; which is initialized in the constructor of the class it is in. In the destructor I have: delete playerArray; except when testing the program through Valgrind it says that there are some calls to delete to a void pointer: operator delete(void*) I want to test whether the playerArr...

pthread_exit vs. return

I have a joinable pthread runner function defined as below: void *sumOfProducts(void *param) { ... pthread_exit(0); } This thread is supposed to join the main thread. Whenever I ran my program through Valgrind I would get the following leaks: LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks indirectly lost: 0 bytes in 0 bloc...

valgrind invalid read of size 4, where is the error?

I'm new with valgrind and I'm trying to use it for memory leaks and other memory problems. In my program I have defined the following class class LM_EXPORT LdpElement : public Visitable, virtual public RefCounted, public NodeInTree<LdpElement> { protected: ELdpElement m_type; // the element type ...

slow down gdb to reproduce bug

Hi, I have a timing bug in my application which only occurs when I use valgrind, because valgrind slows down the process so much. (it's actually a boost::weak_ptr-exception that I cannot localize) Now I wonder how to reproduce the bug with gdb. I don't see a way to combine gdb + valgrind. Thanks. ...

How to locate a free/delete mismatch reported by Valgrind in a multithreaded program ?

Here is the Valgring report: ==14546== Thread 5: ==14546== Invalid free() / delete / delete[] ==14546== at 0x490555D: free (vg_replace_malloc.c:235) ==14546== by 0x3BF7EFAA8F: free_mem (in /lib64/tls/libc-2.3.4.so) ==14546== by 0x3BF7EFA581: __libc_freeres (in /lib64/tls/libc-2.3.4.so) ==14546== by 0x4802676: _vgw_freeres (v...

how can I use valgrind with python c++ extensions?

I have python extensions implemented on c++ classes. I dont have a c++ target to run valgrind with. I want to use valgrind for memory check. Can I use valgrind with python? ...

Valgrind used in C++ development?

I'm quite new to C++ but have some basic C knowledge. In my past C (university) projects, I used Valgrind to check for memleaks. Now, with C++, is Valgrind a valid tool? Does C++ suffer the same problems concerning memleaks like C? Or are there even better tools to use in conjunction with C++? ...

Valgrind won't return source lines!

I've tried running valgrind (memcheck and massif) on an app I wrote, but all I get back are addresses for the functions that executed. --------------------------------- Context accounted for 0.6% of measured spacetime 0x805F29A: (within prog_name) 0x8141740: (within prog_name) Called from: 0.6% : 0x812E077: (within prog_name) ...

Valgrind output interpretation

Let arr be an array of dimension 16 x 20 Here is the valgrind output for the code snippet mentioned. The output is from cachegrind. for (i = 0; i < 20; i++) arr[0][i] = 0; Ir I1mr I2mr Dr D1mr D2mr Dw D1mw D2mw 64 0 0 41 0 0 1 0 0 60 0 0 20 0...

Invalid read of size 8 - Valgrind + C

Valgrind reports error Invalid read of size 8 in the following code. I have an array declared like, struct symbol *st[PARSER_HASH_SIZE]; When my program is initialized, all the elements in this array are initailzied as 0. memset(&st[0], 0, sizeof(st)); My program creates instances of struct symbol and inserts into the above arra...