valgrind

How do I run valgrind with an Android app?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 05:48:51
I've installed valgrind for android and I can confirm it is working as I tried running ls with it, and it works fine. But how do I execute an android app with a native component I would like to debug? I looked at this question: How to start an android app with valgrind but I have no idea how to follow it. How do you wrap an app in a shell script? What is "wrap." followed by the package name supposed to be? I tried doing this with com.matthewmitchell.wakeifyplus being my application package: setprop wrap.com.matthewmitchell.wakeifyplus "logwrapper /data/local/valgrind" but it says "could not

Interpreting callgrind data

丶灬走出姿态 提交于 2019-12-03 05:45:53
问题 I need a dynamic call graph for my app. I run it with callgrind tool ( valgrind suite) and got callgrind.out.xxxxx file. Now, I want to make a graphical representation of this data. KCacheGrind doesn't help me much because it draws a limited part of the graph (draws ~50 functions instead of ~1500 profiled and I don't know how to fix that). How can I get a graph image where all of the functions will be drawn? 回答1: Ok, I've found the way. The generated callgrind.out file you can convert to dot

use valgrind to know time(in seconds) spent in each function

家住魔仙堡 提交于 2019-12-03 04:08:43
问题 is there any extension of valgrind, that can be used in the command window, that would help me know the time, in seconds, spent in each function in my C code? thanks =) 回答1: For machine instruction profiling use valgrind's callgrind (also, cachegrind can do cache and branch prediction profiling which is quite nice). For time measurements use google's cpu profiler, it gives way better results than gprof. You can set sampling frequency and it can show the output as a nice annotated call graph.

Dumping contents of lost memory reported by Valgrind

喜你入骨 提交于 2019-12-03 03:24:43
When I run valgrind --leak-check=yes on a program, a few bytes of lost memory are reported. Is it possible to view the contents of this memory (i.e. dump the data that is stored in it)? You can do that with the last version of Valgrind (3.8.1): Start your executable activating the gdbserver at startup: valgrind --vgdb-error=0 ....<your program> Then in another window, connect a gdb to Valgrind (following the indications given by Valgrind). Then put a breakpoint at a relevant place (e.g. at the end of main) and use the gdb continue command till the breakpoint is reached. Then do a leak search

Lightweight memory leak debugging on linux

懵懂的女人 提交于 2019-12-03 03:12:23
问题 I looked for existing answers first and saw that Valgrind is everyone’s favorite tool for memory leak debugging on linux. Unfortunately Valgrind does not seem to work for my purposes. I will try to explain why. Constraints: The leak reproduces only in customer’s environment. Due to certain legal restrictions we have to work with existing binary. No rebuilds. In regular environment our application consumes ~10% CPU. Say, we can tolerate up to 10x CPU usage increase. Valgrind with default

Memory leak in gcc 4.8.1 when using thread_local?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Valgrind is reporting leaked blocks, apparently one per thread, in the following code: #include <iostream> #include <thread> #include <mutex> #include <list> #include <chrono> std :: mutex cout_mutex ; struct Foo { Foo () { std :: lock_guard < std :: mutex > lock ( cout_mutex ); std :: cout << __PRETTY_FUNCTION__ << '\n' ; } ~ Foo () { std :: lock_guard < std :: mutex > lock ( cout_mutex ); std :: cout << __PRETTY_FUNCTION__ << '\n' ; } void hello_world () { std :: lock_guard < std :: mutex > lock ( cout_mutex ); std :: cout << _

Can&#039;t run a Java Android program with Valgrind

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to start a Java program under Valgring like this (in adb shell): valgrind am start -a android.intent.action.MAIN -n com.me.myapp/.MainActivity I'm getting: ==2362== Memcheck, a memory error detector ==2362== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==2362== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==2362== Command: am ==2362== /system/bin/sh: am: No such file or directory 回答1: You have to create a script, lets call it start_valgrind.sh #!/system/bin/sh PACKAGE="com.example.hellojni"

G++ Multi-platform memory leak detection tool

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Does anyone know where I can find a memory memory leak detection tool for C++ which can be either run in a command line or as an Eclipse plug-in in Windows and Linux. I would like it to be easy to use. Preferably one that doesn't overwrite new(), delete(), malloc() or free(). Something like GDB if its gonna be in the command line, but I don't remember that being used for detecting memory leaks. If there is a unit testing framework which does this automatically, that would be great. This question is similar to other questions (such as Memory

How to build and install Valgrind on Mac?

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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

How to use valgrind with python?

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to memcheck a C python extension I am writing, but I'm having trouble setting up valgrind to work with python. I would really appreciate some advice. Just for context, this is Ubuntu 13.10, python 2.7.5+, and valgrind 3.8.1. As per recommendation from Readme.valgrind I did the following. 1) Downloaded the python source with sudo apt-get build-dep python2.7 apt-get source python2.7 2) Applied the code patch, i.e. "Uncomment Py_USING_MEMORY_DEBUGGER in Objects/obmalloc.c". 3) Applied the suppression patch, i.e. "Uncomment the lines