valgrind

What's up with GTK+ windows having so many memory leaks according to Valgrind?

Whenever I load any GTK+-powered application in valgrind, it reports a lot of memory leaks. What's up with that? Is GTK+ buggy? ...

Can I make valgrind ignore glibc libraries?

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 und...

calling calloc - memory leak valgrind

The following code is an example from the NCURSES menu library. I'm not sure what could be wrong with the code, but valgrind reports some problems. Any ideas... ==4803== 1,049 (72 direct, 977 indirect) bytes in 1 blocks are definitely lost in loss record 25 of 36 ==4803== at 0x4C24477: calloc (vg_replace_malloc.c:418) ==4803== by ...

How do I get callgrind to dump source line information?

I'm trying to profile a shared library on GNU/Linux which does real-time audio processing, so performance is important. I run another program which hooks it up to the audio input and output of my system, and profile that with callgrind. Looking at the results in KCacheGrind, I get great information about what functions are taking up mo...

A error about "Address 0x0 is not stack'd, malloc'd or (recently) free'd" in c program under linux enviroment

[Edit1:] For the seqName, I declare it as a global parameter at the beginning of the file as char seqName[20]; [Edit2:] Aren't those number of passing to the program during the actual execution? I got the following message just by using the valgrind tool. The command I input is: jl@ubuntu:~/work/dsr_analysis$ valgrind --tool=memchec...

Possible memory leak problem

I write two pieces of c programs like following, during memcheck process using Valgrind, a lot of mem leak information is given. int GetMemory(int framewidth, int frameheight, int SR/*, int blocksize*//*,int ALL_REF_NUM*/) { //int i,j; int memory_size = 0; //int refnum = ALL_REF_NUM; int input_search_...

C++'s std::string pools, debug builds? std::string and valgrind problems

Hello, I have a problem with many valgrind warnings about possible memory leaks in std::string, like this one: 120 bytes in 4 blocks are possibly lost in loss record 4,192 of 4,687 at 0x4A06819: operator new(unsigned long) (vg_replace_malloc.c:230) by 0x383B89B8B0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::...

Template Parameter Initialization

Hi, I wrote some C++ code in which I used Templates. Since I used templates, I could not initialize a couple of template class variables. I got an warning message from valgrind saying Conditional jump or move depends on uninitialized value(s). So is there a way to get around this and/or initialize template variables?? I couldn't think ...

Can't figure out where race condition is occuring

I'm using Valgrind --tool=drd to check my application that uses Boost::thread. Basically, the application populates a set of "Book" values with "Kehai" values based on inputs through a socket connection. On a seperate thread, a user can connect and get the books send to them. Its fairly simple, so i figured using a boost::mutex::scope...

"Use of uninitialised value" despite of memset

Hi there, I allocate a 2d array and use memset to fill it with zeros. #include<stdio.h> #include<string.h> #include<stdlib.h> void main() { int m=10; int n =10; int **array_2d; array_2d = (int**) malloc(m*sizeof(int*)); if(array_2d==NULL) { printf("\n Could not malloc 2d array \n"); exit(1); } ...

localtime_r supposed to be thread safe, but causing errors in Valgrind DRD

I searched google as much as I could but I couldn't find any good answers to this. localtime_r is supposed to be a thread-safe function for getting the system time. However, when checking my application with Valgrind --tool=drd, it consistantly tells me that there is a data race condition on this function. Are the common search results ...

malloc.c:3074 + Valgrind output

I am getting the infamous malloc.c:3074 error when running my code (compiles without issue). I compiled using the -g option. I used Valgrind to determine where the memory allocation issue is happening but the results aren't helping a whole lot. Here is the Valgrind output: ==2710== Invalid write of size 8 ==2710== at 0x400FC8: gene...

Installing Valgrind on OS X

Hi, I'm trying to install valgrind on os x (snow leopard/10.6.3). When I run the provided ./configure script I get an error saying: checking for the kernel version... unsupported (10.3.0) configure: error: Valgrind works on Darwin 9.x (Mac OS X 10.5) Has anyone else had experience with this? Can I just delete that line in the config...

How do I merge Valgrind memcheck reports from multiple runs of the same process?

I've got an set of acceptance tests that run nightly. I'd like to use valgrind to check for memory leaks in my code automatically as an additional safe-guard to manually checking for leaks. Updating my scripts to run my processes under valgrind is trivial, however, each test starts and stops a number of processes and there are around 1...

can memory corruption be caused by invalid *reading* freed memory?

I'm getting *** glibc detected *** (/my/program/...): malloc(): memory corruption: 0xf28000fa *** I've run under valgrind, which reports cases of reading memory that has been freed, but no cases of illegal memory writes. Could reading freed memory cause memory corruption? If not, any suggestions where else to look beyond the valgri...

Is it possible to make valgrind ignore certain libraries?

Or preferably all of them instead of just my code? My program uses Gtk, Loudmouth and few other things, and these two (and some behind them, libgcrypto, libssl) are causing so many errors themselves that I'm unable to detect my own. Is it possible to make valgrind ignore things coming from deeper than my own code? ...

Eclipse 3.6 (CDT for linux) and Valgrind - Arguments not working in Profile configuration

Has anyone else had this problem? I just downloaded 3.6 (the CDT for linux flavor), and this isn't working. In the Profile Configurations --> Valgrind --> "Arguments" tab, it doesn't seem to be passing the arguments into the executable. When I debug the same code, it works perfectly. I am not that familiar with Valgrind or the plugin...

Does valgrind track memory initialization through drivers?

valgrind is reporting uninitialized memory errors from code like this: unsigned char buf[100]; struct driver_command cmd; cmd.len = sizeof(buf); cmd.buf = buf; ioctl(my_driver_fd, READ, &cmd); for(i = 0; i < sizeof(buf); i++) { foo(buf[i]); /* <<--- uninit use error from valgrind */ } If I memset() the buf before the driver call,...

C strings, strlen and Valgrind

Hi everybody, I'm trying to understand why Valgrind is spitting out : ==3409== Invalid read of size 8 ==3409== at 0x4EA3B92: __GI_strlen (strlen.S:31) whenever I'm applying strlen on a dynamically allocated string? Here is a short testcase : #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *hello ...

Initializer list makes variable uninitialized?

I have a class with the only constructor like this: IntroScreen::IntroScreen(Game *game) : View(game), counter(0.0f), message(-1), continueAlpha(255), continueVisible(false), screenAlpha(255), fadeIn(false), fadeOut(false) { } And somewhere in a method I have this if-statement if (counter > 10.0f) And Valgrind says for that...