valgrind

Getting Valgrind on Windows 7

醉酒当歌 提交于 2019-12-10 14:59:56
问题 I'm learning C and want to install Valgrind on my system, however when I attempt to install Valgrin I get an error saying Valgrind is OS specific. Sorry I'm running Windows 7, with Mingw64 GIT installed. I've done some research and found this. According to that I need to run sh ./configure --host x86_64 w64-mingw32 However when I run this I get the following output: $ sh ./configure --host x86_64-w64-mingw32 checking for a BSD-compatible install... /usr/bin/install -c checking whether build

std::string memory leak

巧了我就是萌 提交于 2019-12-10 14:57:02
问题 I've got this class AppController and the function connectPlayer : /* AppController.h */ class AppController { // Some other declarations ... private: static const string TAG; }; /* AppController.cpp */ #include "AppController.h" const string AppController::TAG = "AppController"; AppController::AppController() { /* some code here...*/ } void AppController::connectPlayer() { std::string port; std::string host; port = CM->getMenu()->getData("PORT"); host = CM->getMenu()->getData("HOST"); this-

Valgrind errors on simple C string functions

别等时光非礼了梦想. 提交于 2019-12-10 14:53:28
问题 Let's consider this simple test program: #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char buf[256]; int i; strcpy(buf,"Hello world!"); i = strlen(buf); printf("Length of string is %d.\n",i); return 0; } When compiling it with the Intel c++ compiler and optimizations turned on (O3), I get the following errors from valgrind: ==8727== Conditional jump or move depends on uninitialised value(s) ==8727== at 0x4009EF: main (strtest.cpp:11) ==8727== Use of uninitialised

Does Perl v5.10.1 have memory leaks or how to interpret valgrind

喜夏-厌秋 提交于 2019-12-10 14:43:55
问题 I have a script that has memory leaks. I believe this is so because after I perform undef on my nested objects, the amount of memory in script is unchanged. I have used Devel::Cycle to locate any cyclical references and I have turned those cyclical references into weak references with Scalar::Util . The problem still remains. Now I am trying to use Valgrind to solve the issue. As a first start with valgrind, I tested things out a perl hello world program: #! /usr/bin/perl use strict; use

What is the difference between a direct and indirect leak?

限于喜欢 提交于 2019-12-10 13:18:53
问题 I got the following output from the LeakSanitizer tool. What is the difference between a direct and indirect leak, as the tool understands it? 13: ==29107==ERROR: LeakSanitizer: detected memory leaks 13: 13: Direct leak of 288 byte(s) in 6 object(s) allocated from: 13: #0 0x7f2ce0089050 in __interceptor_malloc (/nix/store/zahs1kwq4742f6l6h7yy4mdj44zzc1kd-gcc-7-20170409-lib/lib/libasan.so+0xd9050) 13: #1 0x7f2cdfb974fe in qdr_core_subscribe ../src/router_core/route_tables.c:149 13: #2

Valgrind is not showing invalid memory access with incorrectly used c_str()

梦想的初衷 提交于 2019-12-10 13:01:49
问题 Imagine such code: string f() { string r = "ab"; return r; } int main() { const char *c = f().c_str(); printf("%s.\n", c); return 0; } This code may crash, right? Because that string that c points to is destroyed. But running it via Valgrind doesn't show any invalid memory accesses. Why? I know Valgrind cannot check the stack, but "ab" actually is located on the heap, right? 回答1: This code may crash, right? Because that string that c points to is destroyed. Right. It has undefined behaviour,

Valgrind Error: failed in UME with error 22

故事扮演 提交于 2019-12-10 12:39:00
问题 I am playing around with tool development in Valgrind and am getting the following error: valgrind: mmap(0x8048000, 4096) failed in UME with error 22 (Invalid argument). valgrind: this can be caused by executables with very large text, data or bss segments. but my executable has nothing but simple variable assignments. I am not able to understand how to fix this problem. Any suggestions? 回答1: I solved this for my case and submitted a patch: https://bugs.kde.org/show_bug.cgi?id=290061 If you

Valgrind: disable conditional jump (or whole library) check

孤者浪人 提交于 2019-12-10 03:54:31
问题 I am developing application using OpenSSL API. As it known, OpenSSL uses miriades of global variables which are taken by Valgrind as errors ("conditional jump or move..." etc). Thus the Valgrind's output gets clogged with errors from shared libraries. This is very inconvenient for debug purposes, because every time I get: More than X total errors detected. I'm not reporting any more. Final error counts will be inaccurate. Go fix your program! The questions are: Can I disable party libraries (

valgrind, profiling timer expired?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 01:59:10
问题 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 ==2238== ==2238== ==2238== HEAP SUMMARY: ==2238== in use at exit: 1,168 bytes in 1 blocks ==2238== total heap usage: 1 allocs, 0 frees, 1,168 bytes allocated ==2238== ==2238==

Valgrind shows memory leak with empty main without including headers

≡放荡痞女 提交于 2019-12-09 16:39:26
问题 Lubuntu 15.10 I have project with memory leaks. I can find them, so I cleaned up my main.cpp file, and now it looks like this: int main() { return 0; } When I check memory with the command: valgrind --leak-check=full --show-leak-kinds=all ./MyProgram > log1.txt 2>&1 I got these errors: ==5219== ==5219== LEAK SUMMARY: ==5219== definitely lost: 0 bytes in 0 blocks ==5219== indirectly lost: 0 bytes in 0 blocks ==5219== possibly lost: 728 bytes in 18 blocks ==5219== still reachable: 44,676 bytes