valgrind

How can I use valgrind with Python C++ extensions?

让人想犯罪 __ 提交于 2019-11-27 03:27:38
I have Python extensions implemented on C++ classes. I don't have a C++ target to run valgrind with. I want to use valgrind for memory check. Can I use valgrind with Python? Yes, you can use valgrind with Python. You just need to use the valgrind suppression file provided by the Python developers, so you don't get a bunch of false positives due to Python's custom memory allocation/reallocation functions. The valgrind suppression file can be found here: http://svn.python.org/projects/python/trunk/Misc/valgrind-python.supp IMPORTANT: You need to uncomment the lines for PyObject_Free and PyObject

Is there Valgrind Memcheck like tool for windows to debug use after free errors? [closed]

人盡茶涼 提交于 2019-11-27 01:32:47
问题 Durring my work I regulary face rather common programming error - using some object which has already been freed. This invokes UB in C++. On linux , this kind of problems are usually resolved by using Valgrind tool Memcheck. From Memcheck manual: Memcheck tries to establish what the illegal address might relate to, since that's often useful. So, if it points into a block of memory which has already been freed, you'll be informed of this, and also where the block was freed. Memcheck provides

How to profile memory usage?

我的未来我决定 提交于 2019-11-27 01:31:59
I am aware of Valgrind, but it just detects memory management issues. What I am searching is a tool that gives me an overview, which parts of my program do consume how much memory. A graphical representation with e.g. a tree map (as KCachegrind does for Callgrind) would be cool. I am working on a Linux machine, so windows tools will not help me very much. ismail Use massif , which is part of the Valgrind tools. massif-visualizer can help you graph the data or you can just use the ms_print command. Paolo M Try out the heap profiler delivered with gperftools , by Google. I've always built it

Valgrind reports memory 'possibly lost' when using glib data types

假如想象 提交于 2019-11-27 01:06:05
问题 I'm developing a library using a number of glib datastructures (GHashTable, GSList etc.). I've been checking my code frequently for memory leaks using valgrind. Most of the issues valgrind points out are quite easy to fix, however there's a few that I can't figure out. All of these are reported as 'possibly lost'. At the top of the valgrind stacktrace, I always find the same 4 libraries: ==29997== 1,512 bytes in 3 blocks are possibly lost in loss record 24 of 25 ==29997== at 0x4004B11:

Are there any alternatives to valgrind on Mac OS X Mountain Lion and Mavericks to detect memory leaks for C/C++ applications? [closed]

自闭症网瘾萝莉.ら 提交于 2019-11-27 01:03:26
问题 I used to use valgrind to detect memory leaks for my C/C++ applications on Mac OS X 10.6 (Snow Leopard) and 10.7 (Lion), but I find it's not supported on recent releases like 10.8 (Mountain Lion) and 10.9 (Mavericks) when I upgraded my OS. Is there something else like valgrind that can be installed on Mac OS X 10.9? 回答1: On 2013-11-01, the valgrind team announced Valgrind 3.9.0: We are pleased to announce a new release of Valgrind, version 3.9.0, available from http://www.valgrind.org. 3.9.0

Proper way to initialize C++ structs

和自甴很熟 提交于 2019-11-26 23:51:41
问题 Our code involves a POD (Plain Old Datastructure) struct (it is a basic c++ struct that has other structs and POD variables in it that needs to get initialized in the beginning.) Based one what I've read, it seems that: myStruct = (MyStruct*)calloc(1, sizeof(MyStruct)); should initialize all the values to zero, as does: myStruct = new MyStruct(); However, when the struct is initialized in the second way, Valgrind later complains "conditional jump or move depends on uninitialised value(s)"

Is there a good Valgrind substitute for Windows?

旧巷老猫 提交于 2019-11-26 23:03:18
I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux - I have no other need or interest in moving my OS to Linux so I was wondering if there is a equally good program for Windows. Some more good commercial tools: Purify Insure++ As jakobengblom2 pointed out, valgrind has a suit of tools. Depending which one you are talking about there are different windows counter parts. I will only mention OSS or free tools here. 1. MemCheck: Dr. Memory. It is a relatively new tool, works very well on Windows 7. My favorite feature is that it groups the same

Why does Valgrind not detect a memory leak in a Rust program using nightly 1.29.0?

删除回忆录丶 提交于 2019-11-26 21:50:46
问题 I'm trying to detect a memory leak in a Rust program using Valgrind following this blog post. My source code is simply: #![feature(alloc_system)] extern crate alloc_system; use std::mem; fn allocate() { let bad_vec = vec![0u8; 1024*1024]; mem::forget(bad_vec); } fn main() { allocate(); } I expect the call to mem::forget() to generate a memory leak that Valgrind would be able to pick up on. However, when I run Valgrind, it reports that no leaks are possible: [memtest]> cargo run Compiling

How to use the addr2line command in Linux?

和自甴很熟 提交于 2019-11-26 21:43:22
I am trying to use addr2line command in Unix but everytime it is giving the same output as ??:0. I am giving command as addr2line -e a.out 0x4005BDC . I got this address while running this a.out executable with valgrind tool to find the memory leakage. I also compiled the source code with -g option. You can also use gdb instead of addr2line to examine memory address. Load executable file in gdb and print the name of a symbol which is stored at the address. 16 Examining the Symbol Table . (gdb) info symbol 0x4005BDC Please check: Whether all the functions in your binary are compiled with -g ,

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

可紊 提交于 2019-11-26 19:50:08
问题 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 ... obj:/path/to/library/thelibrary.so } This doesn't entirely do the job, however. I have to create one of these for every suppression type that comes up (Cond, Value4, Param,