valgrind

Why does valgrind say basic SDL program is leaking memory?

Here is the SDL program: #include <SDL/SDL.h> int main(int argc, char** argv){ SDL_Init(SDL_INIT_VIDEO); SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE); SDL_Quit(); return 0; } Compiled with the command: g++ -o test test.cpp -lSDL And here is the output of valgrind: christian@christian-laptop:~/cpp...

Detailed Valgrind internals documentation

I'm thinking of making a D interface to Valgrind's client request API. By mucking around in the header files and de-compiling stuff, I could eventually figure out what it's doing but I'm wondering if their is a authoritative document on how things work? (BTW I already found this document but it doesn't have enough info) What I'm looking...

Pros/Cons of Static and Dynamic Instrumentation

There are many static and dynamic instrumentation tools. Soot is a static instrumentation tool for Java bytecode. Pin and Valgrind are dynamic instrumentation tools for binaries. What are pros and cons for static and dynamic instrumentation tools? I think static instrumentation tools are better in terms of runtime performance, whereas d...

How to record every allocations and deallocations of memory on a program?

I want to see is fragmentation the reason of increasing memory usage of my twisted server. I have posted a question here: How to find the source of increasing memory usage of a twisted server? Now, what I am going to do is to visualize the heap. I found an article: Memory fragmentation. The figure of heap in that article is something ju...

Valgrind claims there is unfreed memory. Is this bad?

Valgrind gives me the following leak summary on my code. However, I have freed all malloc'ed memory. Is this a bad thing, or is this normal? My program is in c. ==3513== LEAK SUMMARY: ==3513== definitely lost: 0 bytes in 0 blocks. ==3513== possibly lost: 0 bytes in 0 blocks. ==3513== still reachable: 568 ...

valgrind, profiling timer expired??

I try to profile a simple c prog using valgrind: [zsun@nel6005001 ~]$ valgrind --tool=memcheck ./fl.out ==2238== Memcheck, a memory error detector ==2238== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==2238== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==2238== Command: ./fl.out ==2...

Unexpected Memory Leak [Valgrind]

Today I was just trying to check how valgrind works. So I created a simple program. //leak.C #include<iostream> class leak { int *p; public: leak():p(new int[10]()){std::cout<<"Constructor of leak called\n";} virtual void set() { for(int i=0;i<10;++i) p[i]=i*i; } virtual void display() { std::...

Uninitialised value was created by a heap allocation

I have been chasing this bug around, and I just don't get it. Have I forgotten some basic C or something? ==28357== Conditional jump or move depends on uninitialised value(s) ==28357== at 0x4C261E8: strlen (mc_replace_strmem.c:275) ==28357== by 0x4E9280A: puts (ioputs.c:36) ==28357== by 0x400C21: handlePath (myshell.c:105) ==2...

Limiting resource usage for debugging an application on linux

I have a C/C++ application that crashes only under heavy loads. I normally use valgrind and gprof to debug memory leaks and profiling issues. Failure rate is like about 100 in a million runs. This is consistent. Rather than reproduce the traffic to my application, can I superficially limit the resources available to the debug build of th...

Send signal to a process inside valgrind?

Hi, How can I send a signal to my process which runs inside valgrind to check its memory usage status? Thanks! ...

Searching for memory leaks in Apache httpd and modules

What is the best way for finding memory leaks in Apache httpd and httpd modules? Are there any howtos? I'v tried valgrind a little, but few obstacles appeared: Valgrind expects for binary to exit normally. I have managed to do that with MaxRequestsPerChild and -X parameter. Valgrind reports about lots of stuff, probably connected wit...

Debugging PHP Memory Corruption with Valgrind

Hi. I'm encountering what seems to be a memory corruption issue with PHP. I have a large code base that I am porting to the 5.3 runtime. I get segfaults and "zend_mm_heap corrupted" errors, but the backtraces from those points are not useful. The backtraces always lead back to various core PHP functions such as variable assignment or co...

How can I compile Valgrind on Snow Leopard?

How can I compile Valgrind on Snow Leopard? ...

Complement to valgrind?

I have been working for the last few weeks trying to track down a really difficult bug that crashes my application. First, the application was crashing on the assign of a std::string, then during the free of a local variable. After careful inspection of the code, there was no reason for it to crash at these locations; however, it alway...

C++ Program Always Crashes While doing a std::string assign

I have been trying to debug a crash in my application that crashes (i.e. asserts a * glibc detected free(): invalid pointer: 0x000000000070f0c0 **) while I'm trying to do a simple assign to a string. Note that I'm compiling on a linux system with gcc 4.2.4 with an optimization level set to -O2. With -O0 the application no longer cras...

How to exclude certain child processes to run under valgrind?

Hello, I am running a daemon in Linux and I want to run this daemon under valgrind to find memory related errors. Since it is a daemon , I need to use trace-children = yes option. But this spawns many processes later on during its life time and I dont want them to run under valgrind. Is there a way to exclude certain children from runni...

breakpoints not working after installing valgrind

I just installed valgrind but now my breakpoints dont work in qtcreator. How can I fix this? debug:NO GDB PROCESS RUNNING, CMD IGNORED: -stack-list-arguments 2 0 0 ...

How do you tell valgrind to completely suppress a particular .so file?

Okay, I'm trying to use valgrind on a program that I'm working on, but valgrind generates a bunch of errors for one of the libraries that I'm using. I'd like to be able to tell it to suppress all errors which involve that library. The closest rule that I can come up with for the suppression file is { rule name Memcheck:Cond ......

Using callgrind/kcachegrind to get per-thread statistics

I'd like to be able to see how "expensive" each thread in my application is using callgrind. I profiled with the --separate-thread=yes option which gives you a callgrind file for the whole app and then one per-thread. This is useful for viewing the profile of any given thread, but what I really want is just a sorted list of CPU time ...

How to profile program on Linux platform without rebuilding ?

I've used two profiling tools (VTune on windows and dbx (within sunstudio) on Solaris) which can profile program without rebuild them, and during profiling, the program just run at the same speed as normal. Both of these 2 features saved me a lot of time. Now I want to know if there is some free tools available on Linux platform can do ...