valgrind

cpp - valgrind - Invalid read of size 8

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm getting mad understanding that valgrind error. I've got a template class called Matrix that has some overloaded operators etc... to do some mathematical operations. Matrixes are used inside a class called ExtendedKalmanFilter. Here is the valgrind trace: ==3352== Invalid read of size 8 ==3352== at 0x804CC8F: BOViL::math::Matrix ::operator*(BOViL::math::Matrix const&) const (Matrix.h:285) ==3352== by 0x8051F91: BOViL::algorithms::ExtendedKalmanFilter::forecastStep(double) (ExtendedKalmanFilter.cpp:48) ==3352== by 0x8051F25: BOViL:

why pthread causes a memory leak

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Whenever I create a pthread, valgrind outputs a memory leak, For example the below code: #include #include #include void *timer1_function (void *eit){ (void) eit; printf("hello world\n"); pthread_exit(NULL); } int main(void){ pthread_t timer1; pthread_create( &timer1, NULL, timer1_function, NULL); ///////line13 int i=0; for(i=0;i valgrind outputs ==1395== HEAP SUMMARY: ==1395== in use at exit: 136 bytes in 1 blocks ==1395== total heap usage: 6 allocs, 5 frees, 1,134 bytes allocated ==1395== ==1395== 136 bytes in 1 blocks are possibly lost in

make fails while installing Valgrind

匿名 (未验证) 提交于 2019-12-03 01:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to install Valgrind on a Mac with Snow Leopard but am getting an error. This is what I'm typing into Terminal. $ curl -O http://valgrind.org/downloads/valgrind-3.8.1.tar.bz2 $ md5sum valgrind-3.8.1.tar.bz2 $ tar -xjvf valgrind-3.8.1.tar.bz2 $ cd valgrind-3.8.1 $ ./configure $ make This is the error I get. Making all in coregrind make[2]: *** No rule to make target `/usr/include/mach/mach_vm.defs', needed by `m_mach/mach_vmUser.c'. Stop. make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 How can I correct this error? 回答1:

The Impossible Happened! What does this mean?

匿名 (未验证) 提交于 2019-12-03 01:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have experienced an interesting runtime error. I assume it is some sort of memory leak. I wrote the following program: C Code: #include <gmp.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #define PRECISION 4096 #define DECIMAL_POINT 1 #define NULL_TERMINATOR 1 void gatherSquares(const uint32_t limit, uint32_t ** const arr, uint32_t * const count); uint32_t inList(const uint32_t n, const uint32_t * const arr, const uint32_t count); void print_help(const char * const str); int main(int argc, char* argv[]) {

std::string memory leak

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

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

匿名 (未验证) 提交于 2019-12-03 00:48:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Valgrind reporting a segment overflow 5 answers 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 code: #include <vector> struct Something { Something() : a1(0), b1(0) { }

Valgrind Error: failed in UME with error 22

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

GDB remote debugging with valgrind

蓝咒 提交于 2019-12-03 00:42:45
If I remote debug using gdb I connect to the gdbserver using target remote host:2345 If I debug memory errors with valgrind and gdb (to break on invalid memory access) I use target remote | vgdb (after starting valgrind --track-origins=yes --vgdb=yes --vgdb-error=0 [binary] on the local machine) Can I combine the two to debug memory errors on a remote machine? Note that I want to avoid using a login shell on the remote machine to work there. Can I combine the two to debug memory errors on a remote machine? Yes: current vgdb accepts --port= argument since this commit: r12204 | sewardj | 2011-10

std::thread problems

人盡茶涼 提交于 2019-12-03 00:08:30
I think I have a kind really bad concepts problems. Why I simple get a lot of race conditions error with valgrind. First i thought that could be a bug, and I saw in forums that an updated rolling release of linux will solve this... so now i have opensuse tubleweed, 100% updated. The following code muss have something very wrong: #include <iostream> #include <thread> using namespace std; class FOO { public: void do_something () { cout<<"cout somethin\n"; } }; int main () { FOO foo; std::thread t (&FOO::do_something,&foo); t.join(); } When i do a valgrind --tool=drd ./oncordia i have to try 5

ubuntu16.04上安装valgrind

匿名 (未验证) 提交于 2019-12-02 23:57:01
1、下载最新版本: http://valgrind.org/downloads/current.html#current 2、tar -jxvf valgrind-3.15.0.tar.bz2.tar.bz2 3、cd valgrind-3.15.0 4、sudo ./configure 5、sudo make 6、sudo make install 7、sudo /etc/profile.d/valgrind.sh 添加: LGRIND_ROOT=/home/yinwenbin/software/valgrind-3.15.0 VALGRIND_INCLUDE=/usr/local/include/valgrind VALGRIND_LIB=/usr/local/lib/valgrind export VALGRIND_ROOT VALGRIND_INCLUDE VALGRIND_LIB 8、修改文件权限: sudo chmod +x valgrind.sh 9、 ./ valgrind.sh 10、valgrind --version 11、valgrind使用手册: http://valgrind.org/docs/manual/manual.html 来源:博客园 作者: walker_lin 链接:https://www.cnblogs.com/walker-lin/p