valgrind

Uninitialised value was created by a stack allocation - valgrind

别等时光非礼了梦想. 提交于 2019-12-13 07:41:43
问题 I used valgrind to debug my code with the option track-origins=yes and came across this error. $ valgrind --track-origins=yes ./frgtnlng < in > out ==7098== ==7098== Conditional jump or move depends on uninitialised value(s) ==7098== at 0x4C2F1BC: strcmp (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==7098== by 0x400857: main (frgtnlng.c:24) ==7098== Uninitialised value was created by a stack allocation ==7098== at 0x40064C: main (frgtnlng.c:9) ==7098== ==7098== Conditional jump or

Can valgrind report only the root-cause of reading uninit var?

…衆ロ難τιáo~ 提交于 2019-12-13 07:38:44
问题 In terms of https://blog.mozilla.org/nnethercote/2009/02/27/eliminating-undefined-values-with-valgrind-the-easy-way/ Actually when any actions depend on an earlier jump caused by accessing undefined variables, it reports the same error for those actions. This sometimes is confusing. For example, I could have an error that depends on an if-check that is far away from here, but the code path indeed depends on that one. Given a lot of valgrind errors, I am not sure which one to start. Does

Memory Leaks using Valgrind in /usr/lib/dyld

ε祈祈猫儿з 提交于 2019-12-13 03:57:53
问题 I am running a simple application in C using gcc compiler, and testing it with valgrind. I installed valgrind from homebrew (version: valgrind-3.13.0) and I keep getting a memory leak error, even when running a simple program. I get ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 13 from 13) all problems seem to come from /usr/lib/dyld. ==2041== Memcheck, a memory error detector ==2041== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==2041== Using Valgrind-3.13.0 and

Measure static, heap and stack memory ? (c++, Linux - Centos 7)

杀马特。学长 韩版系。学妹 提交于 2019-12-13 03:05:52
问题 I would like to measure stack, heap and static memory separately because I have some constraints for each one. To measure the heap memory I'm using valgrind->massif tool. Massif should also be possible to measure heap AND stack memory but it shows strange resultats : Last snapshot without --stacks=yes provides total(B)=0, useful-heap(B)=0, extra-heap(B)=0 (so all is fine) Last snapshot with --stacks=yes provides total(B)= 2,256, useful-heap(B)=1,040, extra-heap(B)=0, stacks(B)=1,208 (which

GCC on OS X allocs more memory than expected

风格不统一 提交于 2019-12-13 01:28:47
问题 I am using Mac OS X 10.11.4 with Xcode 7.3 with gcc compiler in it. I downloaded valgrind 3.11 using homebrew. When I run my C program with valgrind, this is the output ==4297== ==4297== HEAP SUMMARY: ==4297== in use at exit: 30,208 bytes in 188 blocks ==4297== total heap usage: 265 allocs, 77 frees, 40,286 bytes allocated ==4297== ==4297== LEAK SUMMARY: ==4297== definitely lost: 0 bytes in 0 blocks ==4297== indirectly lost: 0 bytes in 0 blocks ==4297== possibly lost: 2,064 bytes in 1 blocks

Valgrind: libmysql example program gives 'still reachable:' leak

泪湿孤枕 提交于 2019-12-13 01:24:59
问题 I was using libmysql in a project and I always see the exact leak summary 'still reachable: 73,944 bytes in 21 blocks' every time in Valgrind, which shouldn't be there. Later I tested this sample program from this link: /* Simple C program that connects to MySQL Database server*/ #include <mysql.h> #include <stdio.h> main() { MYSQL *conn; MYSQL_RES *res; MYSQL_ROW row; char *server = "localhost"; char *user = "root"; char *password = "PASSWORD"; /* set me first */ char *database = "mysql";

The Impossible Happened! What does this mean?

和自甴很熟 提交于 2019-12-12 21:12:00
问题 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

Crash caused by invalid exception unwinding?

梦想的初衷 提交于 2019-12-12 19:05:27
问题 I'm debugging a crash which occurs in one of our tests. We have an ODBC driver .so written in C++, which is being tested via iODBC using our test tool (called 'Touchstone'), which is also written in C++. I've compiled all three on Solaris 10 (x86) in 64-bit mode using the Oracle Solaris Studio 12.4 ( NOT GCC). The crash only occurs when Touchstone is built in release mode, so I've spent a fair bit of time stepping through assembly in dbx, and what seems to happen is the following: The 'this'

Conditional jump or move depends on uninitialised value(s)

坚强是说给别人听的谎言 提交于 2019-12-12 14:57:17
问题 I've been struggling with this problem for a while now, searching every possible solution. I'm new to C so I'ts hard. I know I have some variable uninitialized, but I can't find them. I am trying to print a matrix. Here's the constructor: BoardP createNewBoard(int width, int high) { BoardP board = (BoardP) malloc(sizeof(Board)); if (board == NULL) { reportError(MEM_OUT); return NULL; } board->height = high; board->width = width; board->board = (char**) malloc(high * sizeof(char*)); int i; for

QImage and valgrind ; memory leak

℡╲_俬逩灬. 提交于 2019-12-12 14:24:47
问题 I have an issue with the following code: #include <QtGui/QImage> int main(int argc, char* argv[]) { QImage qimage(100, 100, QImage::Format_ARGB32); qimage.fill(Qt::white); qimage.save("test.png", "PNG", 70); return 0; } to be compiled as followed: gcc -I/usr/include/qt4 test.cpp -lQtGui The code generates a proper image. However, when I valgrind it: valgrind --leak-check=full ./a.out it yields a series of lost blocks, like the following one: ==5974== 158 (56 direct, 102 indirect) bytes in 1