Questions tagged [valgrind]
Valgrind is a dynamic analysis tool for Linux, OS X, Android, and Solaris systems. It can be used for profiling as well as for finding memory leaks, race conditions, and threading errors.
3,872
questions
1
vote
1
answer
39
views
Valgrind message: Conditional jump or move depends on uninitialised value(s) unresolved
I'm trying a new assignment I've got: I need to copy the Environment variables from the shell into an array, then lowercase them and print them back. (I'm using Ubuntu 20.04.4 LTS, gcc for compiling, ...
0
votes
0
answers
8
views
How do I prevent valgrind from creating extra log files when using popen?
valgrind-3.15.0
I have a weird issue with valgrind when I use switches --trace-children, --trace-children-skip and --log-file along with popen().
My code:
#include <stdlib.h>
#include <stdio....
0
votes
0
answers
18
views
How to solve an error when using "make start" docker [Internal Server Error for url] [closed]
I installed docker desktop on my computer (mac) and it installed correctly, because when I type docker -v in the terminal I get Docker version 20.10.14, build a224086. The problem is that when I type ...
0
votes
0
answers
40
views
Cross-compiling Valgrind for ppc32
I fail to cross configure/compile the current master of Valgrind in a docker container with an SDK that was created with Yocto/Bitbake. I found a similar Question here and modified the configure call ...
0
votes
2
answers
74
views
Why do i get this Invalid read size of 8
why do I get an Invalid read of size 8
My goal is to pass an array of integers to a function that will return a pointer to the last Item in the linked list and it will fill the array of Item pointers ...
-2
votes
0
answers
46
views
when data in shared_ptr is deleted [closed]
im trying to use shared pointers in a program that uses an avlTree that i wrote ,
when i use valgrind i see a lot of errors like this :
==113447== Invalid read of size 4
==113447== at 0x40169C: ...
0
votes
1
answer
63
views
Program behaves different when running with Valgrind
I have a problem debugging my application with Valgrind (memcheck). It behaves differently than when I run it standalone.
There is a place in the code where it tries to determine the associated ...
0
votes
2
answers
45
views
valgrind profiling run crashes when calling constructors
I've got this weird issue when using valgrind which confuses me alot.
im running on ubuntu18.04, c++17, valgrind version 3.13.0
consider this struct:
struct KelvinLine {
float m;
float b;
...
0
votes
1
answer
45
views
Trouble pinpointing source of uninitialized value
I am writing a simple earthquake detection program for the BeagleBone Green using a vibration sensor that I have hooked up, together with a cape that has a built in accelerometer and digit display. ...
0
votes
1
answer
45
views
Segmentation fault memory allocation error
I have a problem with my allocation in this program, I used Valgrind and the error I receive is:
Address 0xe9481f041af07000 is not stack'd, malloc'd or (recently) free'd
And when I compile I receive:
...
0
votes
0
answers
28
views
Valgrind errors not reported when function is inlined
I've been trying to track down the cause of an error reported by Valgrind (see below). It says that a 'Conditional jump or move depends on uninitialised value(s)', pointing to a function call. When I ...
-1
votes
0
answers
51
views
How know how many bits are used in a C program?
Is there a Valgrind style program informing the exact number of bits used when executing a program?
For exemple this program :
int main (void)
{
int a = 0; // an int has 32 bits
}
should return ...
0
votes
0
answers
9
views
How to get python backtraces for python in valgrind
I'm trying to find a file descriptor leak in python code with valgrind but the backtraces look like this:
==2169309== Open file descriptor 11:
==2169309== at 0x497648B: eventfd (syscall-template.S:...
0
votes
1
answer
28
views
Valgrind errors from dynamically allocated arrays in C++
The program is aimed to take a dynamically allocated array and return a new dynamically allocated array with double the size that copies the values in the first one and leaves the rest uninitialized. ...
1
vote
0
answers
23
views
Valgrind LeakDefinetlyLost
i have encountered a valgrind problem within this C function. I would be glad if i recive some help, ty.
char* readHTTPRequestFile() {
FILE *HTTPRequestTXT = fopen("HTTP-Request.txt", &...
0
votes
0
answers
38
views
C -> Valgrind -> Conditional jump or move depends on uninitialised value(s)
When i use valgrind i get: Conditional jump or move depends on uninitialised value(s) on line 37.
Line 37 is where the while loop starts, in the function "check".
I dont know what causes ...
0
votes
1
answer
24
views
Using valgrind to start a program that is started using a cryptic bash command
I have the following bashscript in my /opt/mydev folder
COMMAND=""
buildCommand2() {
COMMAND=$COMMAND"--tab -e 'bash -c \"source ~/.bashrc; source ~/Desktop/developer/setup....
0
votes
2
answers
43
views
How can I redirect valgrind output (Heap summary) alongside my program's output in a command?
Hello I'm trying to run valgrind on several input files to find out if there are any memory leaks in my program and want to get the program output alongside valgrind's heap summary into seperate files,...
1
vote
1
answer
44
views
Can Valgrind mend memory corruption?
I am testing a C++ program for problems.
I am running it under valgrind.
I start the program with
// valgrind test
char * p = (char*)malloc(4);
p[4] = 'A';
free(p);
p[0] = ...
0
votes
1
answer
62
views
Is it ok that valgrind shows errors that I catch using try-catch?
I have class Matrix and some tests for constructors:
try {
std::cout << "Matrix with negative size:" << std::endl;
Matrix<int> err_m(-1, 3);
} catch (...
2
votes
2
answers
92
views
Possible memory leak from a handled exception? (With exception handling that calls exit().)
I'm working on a C++ application (an OpenSSL assignment for university), and I'm running it through valgrind, as one does. I've noticed some rather strange output when the program fails due to invalid ...
2
votes
2
answers
49
views
How to trigger erroneous code paths for tests in C?
I very often write tests to my programs to make sure they work 100% of the time under any circumstances (so that later I don't have to spend hours debugging them).
However, all my tests so far were ...
1
vote
1
answer
38
views
0 bytes in 1 blocks are definitely lost in loss record 1 of 1
I'm learning C/C++ as a newcomer from java in school and since it is weekend, I can't get help from there. I got an error like this:
==18== 0 bytes in 1 blocks are definitely lost in loss record 1 of ...
-1
votes
1
answer
35
views
Address 0x is 0 bytes after a block of size allocated valgrind
I saw that there are many topics about it but I still struggle to understand where is my specific problem at the code..
Node*first_word = get_first_random_node (LinkedList);
unsigned int ...
0
votes
1
answer
27
views
How to include flags for valgrind in a makefile?
I have a makefile with a valgrind target that looks like this:
# expects a file `test.keys` to exist; it can contain any numbers.
valgrind: $(PROG) test.keys
valgrind ./$(PROG) < test.keys
If ...
1
vote
0
answers
70
views
Why does interrupting a simple C++ program under Valgrind results in segmentation fault?
Consider the following program:
#include <iostream>
int main() { std::cout << "Hello, World!\n"; }
I compile it with on Ubuntu 20.04 (Focal Fossa) with g++ a.cpp -o a and run ...
0
votes
0
answers
33
views
Valgrind and where new/delete/malloc/free are called from?
I'm running valgrind-3.15.0 on an embedded ARM platform with switches:
--5484-- --tool=memcheck
--5484-- --track-origins=yes
--5484-- --leak-check=full
--5484-- --show-leak-kinds=all
--...
0
votes
0
answers
38
views
How to address the Valgrind invalid read / write of size 1 & Address # is 0 bytes after a block of size x alloc'd in C
I see this Valgrind issue of invalid read / write of size 1 & Address # is 0 bytes after a block of size x alloc'd is quite commonplace and I am unable to quite pinpoint in my context.
For some ...
-1
votes
1
answer
64
views
C++ memory leak. Valgrind - mismatched delete
I receive objects from Thread #1 - its a 3rd party lib code - my callback called on it.
Objects have fixed-length string fields wrapped:
typedef struct somestr_t {
char * Data;
int Len; } ...
0
votes
0
answers
51
views
Using Valgrind with Qt from command line to debug memory error
I'm having a memory error in my Qt-based application, I'm trying to use the Valgrind tool to detect the error but unfortunately when using Valgrind with my executable it runs and finishes without ...
0
votes
0
answers
30
views
Understanding valgrind output: is it for ofstream or some other input?
I am running a rather extensive piece of code for a simulation. I am getting some rather sporadic segfaults in my simulation, and they seem to be centered around the times I write to an external file.
...
1
vote
2
answers
64
views
Valgrind: Invalid read of size 8, bytes after a block of size 8 alloc'd
Have been looking for a simple case as I have on Stack overflow and other sites but still have not found anything, error happens on line 57, then also on line 47, valgrind saying I write a pointer ...
1
vote
0
answers
39
views
DotNet allocates a lot of memory when querying mongoDB
My application is using a lot of memory because I am querying my database a lot. I am posting my C# code hoping someone can tell me what am I doing wrong. I have also created the same program using ...
0
votes
1
answer
37
views
where is error of "Invalid read of size 4" on the line below the definition of int level
the definition of int level has Invalid read of size 4, and valgrind shows Memcheck, a memory error detector.
void sl_set(leapList *head, int *key, int *value) {
leapList *prev[...
-1
votes
1
answer
21
views
I get specific error 1 for when I compile my program using the makefile
I get specific error 1 for when I compile my program using the makefile, my compiler which show this error :
My makefile
0
votes
0
answers
27
views
Bus error 10 for initialisation of my skip list
how can I find the bus error 10 for the initiation process of my skip list???
struct leapList *initSkipList(struct leapList *skipList[]) {
int i;
for (i=0;i<maximum_level;i++) {...
-1
votes
1
answer
85
views
valgrind | Invalid read of size 4 | Address 0x5093430 is 0 bytes inside a block of size 4 free'd
The valgrind log messages:
==29896== Memcheck, a memory error detector
==29896== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29896== Using Valgrind-3.16.1 and LibVEX; rerun with -...
0
votes
0
answers
23
views
Valgrind reports memleak of same type on 3 blocks
Currently working on a project for a database, and using valgrind I already took out most of the leaks. However, at the end, using --leak-check=full and -s, it reports that I am still losing around ...
1
vote
1
answer
50
views
Resizing hash table - Help me Valgrind-debug my program
I'm trying to create a hash table that contains contact numbers and names, when I have too many contacts, I need to resize my hash table. When I do that, I'm having memory leaks + valgrind errors. I'...
1
vote
1
answer
47
views
Valgrind error: Invalid read of size 1 disappears when switching to different variable declaration
I have a while loop which reads stdin until it gets an empty line. It looks like this:
while (strcmp((fgets(line, BUFFER_SIZE - 1, stdin)), "\n") != 0)
{
process_line(line, option);
...
0
votes
0
answers
17
views
Valgrind ignore program exit code [duplicate]
I am making a testing script
which needs to check the exit code
of valgrind,
valgrind exits with the exit code
of the program no matter what (which is
not what I need) is there a way to
check if ...
0
votes
1
answer
31
views
Helgrind is working correct or not for concurrent queue example?
I have a code snippet from the course which is "Learn Multithreading with Modern C++" from udemy. (it is concurent queue demo example)
#include <queue>
#include <mutex>
#include &...
0
votes
0
answers
32
views
What causes memory errors after calling realloc()? [duplicate]
I have a program that only does two things for now. Read data from two files, into two arrays as structs, and then freeing these arrays. These stucts have strings in them, so I malloc() memory for ...
0
votes
0
answers
103
views
Cannot find Valgrind executable for use with CLion?
I am trying to connect Valgrind with CLion 2020.2.1 for testing purposes, but CLion (and perhaps I) cannot locate the Valgrind executable.
The path I am currently using is:
\\wsl$\Ubuntu\usr\bin\...
0
votes
1
answer
64
views
C - Can't find memory leaks (Valgrind)
I'm new at covering memory leaks and I'm concerned about the problem of leaks. I'm using Valgrind.
I've solved most of it ye't I cant pinpoint where the last (14) leaks come from as I feel I'm freeing ...
2
votes
2
answers
79
views
Opening and closing a log file leads to memory leaks in C
Debugging a legacy code. I have a program written in C. it's actually much longer but I have created a small reproducible program to show the issues (please ignore the fact that this program does not ...
0
votes
1
answer
62
views
Valgrind ClientCheck uninitialized string
I'm new to Valgrind, and I've had some trouble finding the source of some of it's warnings. I've been using the VALGRIND_CHECK_VALUE_IS_DEFINED macro from memcheck.h to try and locate the exact source ...
0
votes
1
answer
22
views
Memory leak when malloc is called in a different function [duplicate]
The code looks something like this
void otherfunc(char* str) {
str = malloc(128);
// Initialize str to something
}
void mainfunc() {
char* foo = NULL;
otherfunc(foo);
...
0
votes
0
answers
55
views
Valgrind report memory leak on google::protobuf::MessageLite::SerializeAsString() const
first my program was reported memory leak issue, and then I use valgrind to track it and get the below result:
==00:00:03:06.365 116370== 557,024 bytes in 1 blocks are definitely lost in loss record ...
1
vote
1
answer
52
views
Mancala program showing correct output but valgrind showing errors
I had an assignment to replicate mancala. The rules of the game are slightly different from original, and are the following:
The active player removes all stones from a pit on their side of the board ...