valgrind

Heap corruption not detected by Valgrind or Electric Fence. Should I be suspicious? (C++)

泪湿孤枕 提交于 2019-11-29 20:27:20
问题 I recently encountered my first battle (solved) with heap corruption. On my linux machine at home the culprit code exits without error using valgrind and electric-fence(with gdb). Yet on the windows machine in our lab, I consistently get the heap corruption related error message from VS described in my referenced post. Is it surprising (or at least uncommon) that valgrind and electric fence wouldn't detect such a problem? Someone else mentioned a possibly similar bug that eluded valgrind in a

Coding a getline() implementation - Valgrind errors

隐身守侯 提交于 2019-11-29 18:02:30
I have to recode an implementation of the getline() function, but using the file descriptor of the file and not a FILE * . I am only allowed to use malloc() and free() , along with 5 functions being 25 lines long at most. I think I've done correctly the project although I am a beginner in C and my code isn't probably good. When I run it, it works fine, but valgrind shows that I definetely lost x bytes , x depending of the file length and the READ_SIZE (macro defined in the header). According to valgrind's --leak-check=full , I have a memory leak in the str_realloc_cat function, when I malloc

Valgrind and CUDA: Are reported leaks real?

心已入冬 提交于 2019-11-29 17:49:20
问题 I have a very simple CUDA component in my application. Valgrind reports a lot of leaks and still-reachables, all related to the cudaMalloc calls. Are these leaks real? I call cudaFree for every cudaMalloc . Is this valgrind's inability to interpret GPU memory allocation? If these leaks are not real, can I suppress them and have valgrind only analyse the non-gpu part of the application? extern "C" unsigned int *gethash(int nodec, char *h_nodev, int len) { unsigned int *h_out = (unsigned int *

Clang with -faddress-sanitizer on Windows

做~自己de王妃 提交于 2019-11-29 17:44:36
问题 My intent is to use Clang as a replacement for Valgrind on Windows to find buffer overflows, dynamic memory misuse etc. in C/C++ programs that I've written. I have successfully built Clang following the instructions provided here. I attempted to compile a simple C program with the -faddress-sanitizer option (as specified here) and the following the error is thrown - gcc.exe: error: unrecognized command line option '-faddress-sanitizer' Using built-in specs. COLLECT_GCC=C:/MinGW/bin/gcc.exe

Make valgrind stop immediately after first error

安稳与你 提交于 2019-11-29 16:55:17
问题 my program processes large errors and during development in produces large amount of output on the console. It suffers from memory corruption and I try to use valgrind to locate the error. Unfortunately, i can't find the error messages among the output lines, and they flushing by too fast to cancel execution when they pop up. They have to be there in order to locate the error ( which element does cause the error and so on ). Redirecting then within my program doesn't work, just like piping

cpp gdb valgrind - memory usage statistic while app is running and valgrind unhandled syscall

时间秒杀一切 提交于 2019-11-29 16:20:57
1) I want to get information about memory usage while my program is running (by request). My program create session-objects on the fly and I want to get information about memory usage of all there objects. Is it possible? Seems this can be done by Valgrind . How to use it? How to run it? (commands) 2) My program is background multithread daemon (it also use Local Unix Sockets). I can not run my program under valdrind valdrind ./daemon start . I got following tons of messages: --19454-- it at http://valgrind.org/support/bug_reports.html. caught signal 5068246 --19454-- WARNING: unhandled

Is there a bug in the boost asio HTTP Server 3 example or boost bug?

爷,独闯天下 提交于 2019-11-29 15:46:55
boost library version 1.53 Debian Linux 6.0 ( Linux 2.6.32-5-amd64 on x86_64 ) It is hard to test own software when valgrind log contains lots of warnings. So with no changes I built the HTTP server3 example and run it under the Valgrind. Take a look, please. Did I miss something? valgrind --tool=helgrind --log-file=valgrind.log ./server3 0.0.0.0 83 5 /root/server3 Here is the Helgrind log (edited to 30000 body characters limit, full log http://pastebin.com/Vkbr9vsA ): Helgrind, a thread error detector Copyright (C) 2007-2012, and GNU GPL'd, by OpenWorks LLP et al. Using Valgrind-3.9.0.SVN and

Memory leak in OpenSSL function EVP_EncryptFinal_ex

天涯浪子 提交于 2019-11-29 15:17:23
I implemented encryption procedure based on the tutorial: http://www.openssl.org/docs/crypto/EVP_EncryptInit.html# When I run it trough valgring and got the following report: ==2371== 176 bytes in 1 blocks are still reachable in loss record 3 of 6 ==2371== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64- linux.so) ==2371== by 0x56CA133: CRYPTO_malloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==2371== by 0x575280F: lh_new (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==2371== by 0x5754D4F: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==2371== by 0x575503E: ??? (in

Is it up to the programmer to deallocate on exit()?

走远了吗. 提交于 2019-11-29 15:12:27
I have a program and when I input wrong data from the keyboard it just exits with exit(1) . I was testing with Valgrind and while this happens there are no errors, but I can see that there are still reachable x bytes. So my question: Is it up to the programmer to free memory before hitting an exit() or is the OS going to take care of it? It's a good idea (and in old enough versions of Windows, it was essential), but when a program exit() s on modern operating systems its entire address space is reclaimed. In the end, the OS will take care of it (on every modern OS, it was not the case with

making valgrind able to read user input when c++ needs it

此生再无相见时 提交于 2019-11-29 14:50:10
I am trying to run my c++ program with valgrind, however I have some points in the program which require user input from stdin, but when i run with valgrind, it wont let the user input anything for the program, is there a way around this? Been searching all around but have not found the answer. I haven't tried it, but I found this in the man pages: --input-fd=<number> [default: 0, stdin] Specify the file descriptor to use for reading input from the user. This is used whenever valgrind needs to prompt the user for a decision. What happens if you specify a different fd (say, 3) for valgrind to