valgrind

strstr valgrind error

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need some help with char* initialization and strstr in C. This is the general issue: I have a function func1 func1() func2(); The issue is that valgrind gives an error basically saying that strstr might be using an uninitialized value. To rectify this, I'd have to do something like char* str = "hello world"; , but then I can't realloc , which is an issue. I have tested my program with random strings and the issue is the fact that valgrind is treating str as uninitialized, but I just don't know how to initialize it without getting rid of

Can I make valgrind ignore glibc libraries?

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to tell valgrind to ignore some set of libraries? Specifically glibc libraries.. Actual Problem: I have some code that runs fine in normal execution. No leaks etc. When I try to run it through valgrind, I get core dumps and program restarts/stops. Core usually points to glibc functions (usually fseek, mutex etc). I understand that there might be some issue with incompatible glibc / valgrind version. I tried various valgrind releases and glibc versions but no luck. Any suggestions? 回答1: This probably doesn't answer your

Using valgrind to spot error in mpi code

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a code which works perfect in serial but with mpirun -n 2 ./out it gives the following error: ./out': malloc(): smallbin double linked list corrupted: 0x00000000024aa090 I tried to use valgrind such as: valgrind --leak-check=yes mpirun -n 2 ./out I got the following output: ==3494== Memcheck, a memory error detector ==3494== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==3494== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==3494== Command: mpirun -n 2 ./out ==3494== Grid_0/NACA0012.msh Grid_0

How to build and install Valgrind on Mac?

自作多情 提交于 2019-12-03 02:22:23
I am on Mac OS X using codeblocks 10.05 I downloaded Valgrind, and extracted a folder. I am completely lost from there, and have no idea how to build it. I do not know ANY terminal/console commands and am generally new to programming, so I have no idea how to "build" or "compile" it. I just have a folder called Valgrind with a bunch of random files in it. Could someone please tell me how to proceed? I already checked the website/documentation but it didn't really give me installation instructions, just usage instructions. Thanks PS: I know I already posted this question, but the previous

Memory stability of a C++ application in Linux

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to verify the memory stability of a C++ application I wrote and compiled for Linux. It is a network application that responds to remote clients connectings in a rate of 10-20 connections per second. On long run, memory was rising to 50MB, eventhough the app was making calls to delete... Investigation shows that Linux does not immediately free memory. So here are my questions : How can force Linux to free memory I actually freed? At least I want to do this once to verify memory stability. Otherwise, is there any reliable memory

Current state of drd and helgrind support for std::thread

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: As I transition my code to C++11, I would very much like to convert my pthread code to std::thread. However, I seem to be getting false race conditions on very simple programs in drd and in helgrind. #include <thread> int main(int argc, char** argv) { std::thread t( []() { } ); t.join(); return 0; } Helgrind output snippet - I also get similar errors in drd, using gcc 4.6.1, valgrind 3.7.0 on Ubuntu 11.11 amd64. My questions are: sanity check: Am I doing anything wrong? Are others getting similar false reports on simple std::thread programs?

How does valgrind work?

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can someone provide a quick top level explanation of how Valgrind works? An example: how does it know when memory is allocated and freed? 回答1: Valgrind basically runs your application in a "sandbox." While running in this sandbox, it is able to insert its own instructions to do advanced debugging and profiling. From the manual: Your program is then run on a synthetic CPU provided by the Valgrind core. As new code is executed for the first time, the core hands the code to the selected tool. The tool adds its own instrumentation code to this

C - Segmentation Fault with strcmp?

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I appear to be getting a segmentation fault somewhere with the strcmp function. I'm still very new to C and I can't see why it gives me the error. int linear_probe(htable h, char *item, int k){ int p; int step = 1; do { p = (k + step++) % h->capacity; }while(h->keys[p] != NULL && strcmp(h->keys[p], item) != 0); return p; } gdb: Program received signal SIGSEGV, Segmentation fault. 0x0000003a8e331856 in __strcmp_ssse3 () from /lib64/libc.so.6 (gdb) frame 1 #1 0x0000000000400ea6 in linear_probe (h=0x603010, item=0x7fffffffde00 "ksjojf", k=

Segmentation fault in malloc_consolidate (malloc.c) that valgrind doesn&#039;t detect [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Segfaults in malloc() and malloc_consolidate() 2 answers My program goes in segmentation faults, and I cannot find the cause. The worst part is, the function in question does not always lead to segfault. GDB confirms the bug and yields this backtrace: Program received signal SIGSEGV, Segmentation fault. 0xb7da6d6e in malloc_consolidate (av= ) at malloc.c:5169 5169 malloc.c: No such file or directory. in malloc.c (gdb) bt #0 0xb7da6d6e in malloc_consolidate (av= ) at malloc.c:5169 #1 0xb7da9035 in

Mismatched in Heap summary error

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know I do not need to worry about the Still reachable bytes, but this case is different. My files: wscramble_fio.cpp // wscramble.cpp // Word Scramble guessing game // Illustrates string library functions, character arrays, // arrays of pointers, etc. #include #include #include #include #include #include using namespace std; // Prototype void permute(char items[], int len); // Define an array of strings (since a string is just a char array) // and since string are just char *'s, we really want an array of char *'s int main(int argc, char *