valgrind

Why does C tolerate missing function declarations?

北战南征 提交于 2019-12-23 18:53:00
问题 We came across an unusual phenomenon today, a colleague was calling a normally well-behaved function in his code which was triggering a segfault in libc (gethostbyname). The puzzling thing was that the same function worked without trouble in other source files in the same run-time. Astoundingly, the segfault disappeared when valgrind was used, in fact, it worked perfectly with valgrind, with no errors reported. After much sacrifices to appease the compiler gods we eventually realised that the

Why am I getting memory errors when accessing this matrix in OpenCV?

喜你入骨 提交于 2019-12-23 17:26:27
问题 I'm simply trying to write to a matrix of a given size. When I run this program in Valgrind, I get memory errors as shown below: main.cpp: #include <iostream> #include <opencv2/opencv.hpp> int main() { cv::Mat m = cv::Mat::zeros(cv::Size(59, 9), CV_32SC1); m.at<int>(9, 4) = 1; } Compiling instructions: g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib/ -g -o binary main.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv

Running a JNI application in the Sun VM under Valgrind

蓝咒 提交于 2019-12-23 15:27:51
问题 The sun JVM spits out a LOT of extra noise when run under valgrind, which makes tracking memory problems in the application very challenging. I'd like to find either a suppression file, or a VM runtime mode, that will strip out spurious memory errors in order to separate the wheat from the chaff in this situation. Any suggestions? 回答1: What about profiling this native code outside of the Java application? Usually the JNI code is a wrapper around some library that is not Java specific. Not

TBB possible memory leak

℡╲_俬逩灬. 提交于 2019-12-23 14:56:50
问题 Test program: #include <tbb/parallel_invoke.h> int main(void) { tbb::parallel_invoke([]{},[]{}); return 0; } Compiled using g++ -std=c++11 tmp.cpp -ltbb Checked with valgrind --tool=memcheck --track-origins=yes \ --leak-check=full --log-file=report ./a.out` libtbb version: 4.0 , valgrind version: 3.8.1 . Part of the above test result: possibly lost: 1,980 bytes in 6 blocks Question is: Is this a TBB bug? Or is this possible lost actually safe, it's just some codes that valgrind does not

On OSX Valgrind reports this memory leak, Where is it coming from?

女生的网名这么多〃 提交于 2019-12-23 10:08:52
问题 On OSX Valgrind reports this memory leak, Where is it coming from? The code is c compiled with g++ as c++ code (i do this for function overloading). ==13088== 18 bytes in 1 blocks are definitely lost in loss record 82 of 264 ==13088== at 0x1F25DC: malloc_zone_malloc (vg_replace_malloc.c:267) ==13088== by 0xA1AEDA: malloc_set_zone_name (in /usr/lib/system/libsystem_c.dylib) ==13088== by 0xA1B4A7: _malloc_initialize (in /usr/lib/system/libsystem_c.dylib) ==13088== by 0xA1B5DD: malloc_good_size

Valgrind reporting “brk segment overflow in thread #1” [duplicate]

戏子无情 提交于 2019-12-23 09:19:23
问题 This question already has answers here : Valgrind reporting a segment overflow (5 answers) Closed 2 years ago . I wonder what this message implies: ==18151== brk segment overflow in thread #1: can't grow to 0x4a26000 Note that the code runs just fine and the output is correct. Should I just ignore this message? And what does it mean? 回答1: I think you can ignore it. I got the message in a new allocation in some code that seemed to work perfectly and I also get the message it in the following

deleting array from heap

依然范特西╮ 提交于 2019-12-23 07:17:06
问题 My question is about deleting an array from heap memory. I read a book and this blog and other resources like this one, and all of them said that for deleting an array from heap we must use the [] after the delete function so if we write our codes without using [] then we have leaked memory. for instance, consider below program int *s = new int[10]; delete [] s; I tested this little program in Linux by using the valgrind package(this package could check how much leaked memory produces by bad

What is _dl_lookup_symbol_x ? - C++ Profiling

淺唱寂寞╮ 提交于 2019-12-23 07:05:05
问题 I'm using valgrind/callgrind to profile my server code for some optimization. The two most used calls that callgrind is reporting to me (using kcachegrind to view) are _dl_lookup_symbol_x and do_lookup_x. However I have no idea what either of these are and can't seem to find any documentation about them. Could anyone please tell me where these two functions are used and what they do? 回答1: _dl_lookup_symbol_x is an internal function inside the glibc C runtime library. If you browse the source

openmpi with valgrind (can I compile with MPI in Ubuntu distro?)

强颜欢笑 提交于 2019-12-23 05:11:52
问题 I have a naive question: I compiled a version of Openmpi 1.4.4. with Valgrind : ./configure --prefix=/opt/openmpi-1.4.4/ --enable-debug --enable-memchecker --with-valgrind=/usr.... I want to do memory check. Usually for debuggin (and running) I compile it with OpenMPI in Ubuntu distributive with CC = mpic++ CCFLAGS = -g The question is, can I compile my code just with Ubuntu distro MPI 1.4.3 and then run with this modified (valgrind) mpirun version: mpirun -np 8 valgrind .... ? 回答1: You can

How do I find why the virtual memory foot print continuously grows with this daemon?

跟風遠走 提交于 2019-12-23 05:04:43
问题 I created a daemon which I use as a proxy to the Cassandra database. I call it snapdbproxy as it proxies my CQL commands from my other servers and tools. Whenever I access that tool, it creates a new thread, manages various CQL commands, and then I cleanly exit the thread once the connection is lost. Looking at the memory footprint, it grows really fast (the most active systems quickly reach Gb of virtual memory and that makes use of some swap memory which grows constantly.) On startup, it is