valgrind

dump valgrind data

可紊 提交于 2019-12-01 02:24:00
问题 I am using valgrind on a program which runs an infinite loop. As memcheck displays the memory leaks after the end of the program, but as my program has infinite loop it will never end. So is there any way i can forcefully dump the data from valgrind time to time. Thanks 回答1: Have a look at the client requests feature of memcheck . You can probably use VALGRIND_DO_LEAK_CHECK or similar. EDIT : In response to the statement above that this doesn't work. Here is an example program which loops

How to get the full call stack from Valgrind?

两盒软妹~` 提交于 2019-12-01 02:22:40
I run Valgrind with the following parameters: --leak-check=full --show-reachable=yes --leak-resolution=high --num-callers=100 --trace-children=yes In memory leaks log, I see some error messages with full stack trace up to main, but some messages look like following: ==3956== 1,999,140 (68,796 direct, 1,930,344 indirect) bytes in 5,733 blocks are definitely lost in loss record 8,842 of 8,845 ==3956== at 0x4022AB8: malloc (vg_replace_malloc.c:207) ==3956== How can I get the full stack trace for these errors? roelofs Getting the full stack trace will require debug symbols for all the libraries

Should I free the pointer returned by setlocale?

空扰寡人 提交于 2019-12-01 02:09:00
问题 int main(int argc, char *argv[]) { char *ret = setlocale(LC_ALL, NULL); // should I free 'ret' ??? // free(ret); return 0; } I've tried both on Linux and OS X 10.10, on Linux, I must not call 'free', but on OS X, if I do not call 'free', valgrind complains a memory leak. ==62032== Memcheck, a memory error detector ==62032== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==62032== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info ==62032== Command: ./a.out

Python memory leaks?

蹲街弑〆低调 提交于 2019-12-01 01:28:13
问题 I am writing a python extension that seems to be leaking memory. I am trying to figure out the soure of the problem using valgrind. However, it seems that python itself is leaking memory according to valgrind. Using the following simple script: hello.py print "Hello World!" and doing > valgrind --tool=memcheck python ./hello.py (...) ==7937== ERROR SUMMARY: 580 errors from 34 contexts (suppressed: 21 from 1) ==7937== malloc/free: in use at exit: 721,878 bytes in 190 blocks. ==7937== malloc

Valgrind… 4 bytes inside a block of size 8 free'd

為{幸葍}努か 提交于 2019-12-01 00:49:19
问题 I'm getting this error in Valgrind after attempting to free a list. print_list dumps the list to the syslog. I'm pretty confident that output is correct. Valgrind: ==7028== 1 errors in context 1 of 10: ==7028== Invalid read of size 4 ==7028== at 0x8049603: free_list (list.c:239) ==7028== by 0x80488B5: m61_close_for_valgrind (m61.c:36) ==7028== by 0x8048825: main (mytest.c:19) ==7028== Address 0x420006c is 4 bytes inside a block of size 8 free'd ==7028== at 0x4028F0F: free (vg_replace_malloc.c

Valgrind giving error but everything seems fine

时光怂恿深爱的人放手 提交于 2019-12-01 00:41:08
This one seems like a duplicate of my previous post but it is not..... Here Valgrind giving the following error: udit@udit-Dabba ~/mec $ valgrind --leak-check=full sendip -v -p ipv6 -f file.txt -6s ::1 -p esp -es 0x20 -eq 0x40 -ei z30 -eI z100 -p tcp -ts 21 -td 21 ::2 ==4331== Memcheck, a memory error detector ==4331== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==4331== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==4331== Command: sendip -v -p ipv6 -f file.txt -6s ::1 -p esp -es 0x20 -eq 0x40 -ei z30 -eI z100 -p tcp -ts 21 -td 21 ::2 ==4331== esp

Valgrind legitimate “possibly lost” bytes example

血红的双手。 提交于 2019-12-01 00:34:51
问题 I saw that valgrind classifies memory leaks into: definitely lost indirectly lost possibly lost still reachable suppressed I just fixed a leak where the "possibly lost" was the main problem. The documentation says: " possibly lost means your program is leaking memory, unless you're doing unusual things with pointers that could cause them to point into the middle of an allocated block; see the user manual for some possible causes" May I please know an example of " doing unusual things with

Valgrind does not show line-numbers

寵の児 提交于 2019-12-01 00:21:27
问题 I'm trying to find out where I made invalid writes to a piece of memory using Valgrind. It tells there is such an issue, also in what function, but not in what line. Although the function is quite small, I'd like to have the line-number shown in Valgrind. I've seen this on some outputs of Valgrind, but currently they are not shown, and I wonder why. The output is the following: niklas@emerald:~/Arbeitsfläche/spyr/bin/Debug$ valgrind --tool=memcheck --leak-check=full --show-reachable=yes .

Make callgrind show all function calls in the kcachegrind callgraph

荒凉一梦 提交于 2019-11-30 22:33:42
I was using valgrind tool - callgrind and kcachegrind for profiling a large project and was wondering if there is a way that callgrind reports the stats from all the functions (not just the most expensive functions). To be specific - When I visualized the callgraph in kcachegrind, it included only those functions that are quite expensive, but I was wondering if there is a way to include all the functions from the project in the callgraph. Command used for generating profiling info is given below : valgrind --dsymutil=yes --tool=callgrind $EXE I am not sure if I have to give any options to

How to get the full call stack from Valgrind?

谁说我不能喝 提交于 2019-11-30 21:57:32
问题 I run Valgrind with the following parameters: --leak-check=full --show-reachable=yes --leak-resolution=high --num-callers=100 --trace-children=yes In memory leaks log, I see some error messages with full stack trace up to main, but some messages look like following: ==3956== 1,999,140 (68,796 direct, 1,930,344 indirect) bytes in 5,733 blocks are definitely lost in loss record 8,842 of 8,845 ==3956== at 0x4022AB8: malloc (vg_replace_malloc.c:207) ==3956== How can I get the full stack trace for