valgrind

Valgrind on macOS Sierra

北城以北 提交于 2019-11-27 11:57:21
问题 I following this guide: valgrind installation guide After I have downloading the package, and I have run the sh script, but when I launch the make install command, it couldn't create the folder because it don't have the permission (even though I have used the sudo command). Furthermore I tried with brew but I have this error: valgrind: This formula either does not compile or function as expected on macOS versions newer than El Capitan due to an upstream incompatibility. Error: An unsatisfied

Valgrind not showing line numbers in spite of -g flag (on Ubuntu 11.10/VirtualBox)

↘锁芯ラ 提交于 2019-11-27 11:11:14
I'm following 'Learn C the Hard Way', specifically the chapter on Valgrind . This chapter gives you a deliberately wrong program to show how Valgrind works. When I run the exercise under Valgrind I do not get line numbers in my stack trace, just '(below main)' for the errors. I am definitely compiling with the -g flag. My Valgrind output is as follows: djb@twin:~/projects/Learning/C$ valgrind ./ex4 ==5190== Memcheck, a memory error detector ==5190== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==5190== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info

Finding memory leaks in a C++ application with Visual Studio

岁酱吖の 提交于 2019-11-27 10:32:51
问题 In Linux, I have been using valgrind for checking if there are memory leaks in an application. What is the equivalent in Windows? Can this be done with Visual Studio 2010? 回答1: How about Visual Leak Detector? It's not inbuild, but I do think it's the most popular one. 回答2: C++ Memory Validator finds memory and handle leaks in native Windows programs built with Visual Studio, Delphi and other compilers. Fast and can handle large workloads (some users track several billion allocations and

How does valgrind work?

本小妞迷上赌 提交于 2019-11-27 10:25:30
Can someone provide a quick top level explanation of how Valgrind works? An example: how does it know when memory is allocated and freed? 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 and hands the result back to the core, which coordinates

What do the suppressed leaks mean in Valgrind?

半腔热情 提交于 2019-11-27 09:25:15
I have developed a pure-C implementation of FIFO lists (queues) in files fifo.h and fifo.c , and have written a test programme testfifo.c which I compile to ./bin/testfifo . The node structure is defined in list.h . I run my programme through Valgrind on OS X 10.6 like this valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./bin/testfifo and get the following output ==54688== Memcheck, a memory error detector ==54688== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==54688== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==54688== Command: bin

valgrind and openmp, still reachable and possibly lost, is that bad?

白昼怎懂夜的黑 提交于 2019-11-27 09:05:39
c++ newbie here. I've been improving my memory management skills over the last few days, and my program no longer leaks memory according to valgrind. In fact, I get no warnings from valgrind at all. However, when I add openmp loops into my code, I start to get the following errors in valgrind (memcheck): (but no definitely lost blocks) ==6417== 304 bytes in 1 blocks are possibly lost in loss record 3 of 4 ==6417== at 0x4C279FC: calloc (vg_replace_malloc.c:467) ==6417== by 0x4011868: _dl_allocate_tls (dl-tls.c:300) ==6417== by 0x6649871: pthread_create@@GLIBC_2.2.5 (allocatestack.c:570) ==6417=

Valgrind on OS X Yosemite, giving bogus errors? [duplicate]

笑着哭i 提交于 2019-11-27 08:07:56
问题 This question already has an answer here: Valgrind reports errors for a very simple C program 3 answers I'm following along in Learn C The Hard Way and I'm on Exercise 4: Introducing Valgrind. I'm on Mac OS X Yosemite, and as of this writing, there's not a stable build of Valgrind for Yosemite. I found Yosemite and Valgrind and used the directions from the top-voted answer to brew install --HEAD valgrind . This installed Valgrind and I was able to follow along with Zed's exercise. However,

Valgrind Errors on Mac OS X for printf a double

微笑、不失礼 提交于 2019-11-27 08:04:58
问题 At the moment I am learning C with the awesome learncodethehardway series. I encountered the following: I compile the following code and everything looks totally fine to me: #include <stdio.h> int main(int argc, char *argv[]) { int bugs = 100; double bug_rate = 1.2; printf("You have %d bugs a the imaginary rate of %f!\n", bugs, bug_rate); return 0; } It works also correctly. When I run now Valgrind (3.11.0; should be updated for OS X El Capitan) I get following messages: ==18896== Memcheck, a

Valgrind reports leaked memory on OS X 10.8.1

烈酒焚心 提交于 2019-11-27 08:02:59
问题 I'm using Valgrind version 3.8.0 on OS X 10.8.1, Mountain Lion. Regarding compatibility with 10.8.1, Valgrind's site says (italics mine): Valgrind 3.8.0 works on {x86,amd64}-darwin (Mac OS X 10.6 and 10.7, with limited support for 10.8). I know, then, that there is only "limited support" for 10.8.1. Nonetheless, this bug report says (italics mine): This (the latest 3.8.0 release) makes Valgrind compile and able to run small programs on OSX 10.8. Be warned however that it still asserts with

Test for void pointer in C++ before deleting

夙愿已清 提交于 2019-11-27 08:01:44
问题 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 playerArray is a void pointer before calling delete to avoid this error. Does anyone know how to do this? 回答1: Perhaps you meant delete [] playerArray . You need the [] if the