Questions tagged [valgrind]

Valgrind is a dynamic analysis tool for Linux, FreeBSD, macOS, Android, and Solaris systems. It can be used for execution and data profiling as well as for finding memory leaks, race conditions, and threading errors.

Filter by
Sorted by
Tagged with
1 vote
1 answer
55 views

How to run Valgrind and other tools to check memory leaks in Visual studio code?

I have installed "Valgrind Task Integration" extension in Visual studio code and after restarting VS code and typed the following Valgrind command in terminal, "valgrind --leak-check=...
Stackyquest's user avatar
0 votes
1 answer
38 views

Bash crashes in Valgrind when LC_CTYPE is set to C.UTF-8

Bash 5.2 crashes due to an assertion failure in malloc but only when run in Valgrind and only when LC_CTYPE is set. Here's an example output: $ path/to/env - foo=bar LC_CTYPE=C.UTF-8 path/to/valgrind ...
charmoniumQ's user avatar
  • 5,216
0 votes
1 answer
34 views

Valgrind detects reachable blocks even after freeing malloc space in C (cs50 Problem Set 4 Recover)

I have completed the Problem Set 4 of cs50 called recover. You will see below that i have used malloc for a char* called sfile. In the end of the file i remember to free the allocated space (aka sfile)...
Savvidaios's user avatar
-3 votes
0 answers
47 views

vkCreateInstance - realloc() with size 0 - valgrind error

I am memory testing my engine with valgrind and am running into a weird realloc() with size 0 error. This happens with various versions of libnvidia-eglcore.so so I can rule out it's not a driver ...
ZeunO8's user avatar
  • 416
-2 votes
1 answer
33 views

gprofng vs kcachegrind, better experience [closed]

Question is closed for some ridiculous reason. Clearly an admin earning stars or some activity related points system. Stack overflow just getting WORSE and WORSE!! Reddit, here I come part from the ...
user3613174's user avatar
0 votes
1 answer
55 views

Openmp in fortran "Segmentation fault" [duplicate]

My system is on Debian 12 with an Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz. I am trying to parallelize some fortran code with openmp which uses the FFTW library and consists of several modules compiled ...
Marios Giannakou's user avatar
0 votes
1 answer
54 views

How to use valgrind on QNX platform

According to the official documents of valgrind, QNX is not supported. Howerver, I saw some questions about using valgrind on QNX. question1 question2. This confused me. Is it possible to run Valgrind ...
zp xu's user avatar
  • 23
-1 votes
0 answers
12 views

Valgrind error resolved --track-origins=yes

I was getting the valgrind error "Conditional jump or move depends on uninitialized value(s)" but when I add the flag --track-origins=yes the error is resolved. Is there any reason why? I ...
Pallavi's user avatar
-1 votes
0 answers
38 views

Valgrind hanging on wait loop in Qt project

I'm trying to use valgrind to check for memory leaks on my code, but it is hanging on a busy wait loop that I have. I'm using Qt 5.15.3 on Ubuntu 22.04 At first, I thought it was just slow because the ...
Tyras's user avatar
  • 101
-1 votes
0 answers
40 views

How to use valgrind in github ci

I use ctest -T memcheck in order to check memory usage in my tests. So I write include (CTest) to find valgrind in CMakeLists.txt. However, when it is applying in ci I get the error below: Memory ...
tardis3's user avatar
  • 35
0 votes
4 answers
66 views

Program runs but Valgrind detecting a problem when attempting to write to malloc'd memory

To learn more of C, I'm trying to recreate basic data structures. Here's a minimal example of my attempt at an array, which compiles and runs but has a problem detected by valgrind: #include <...
Roger Dodger's user avatar
4 votes
3 answers
106 views

How can I trace all accesses to a memory block?

I am looking to log all accesses to addresses in a block allocated in heap, pointed by a given pointer. In the following example, it would be monitoring all accesses to 1024 bytes from p. #define BLK ...
onlycparra's user avatar
0 votes
2 answers
69 views

cs50 recover sill reachable but no valgrind error

I have been struggling with the 'recover' program for a few hours and cannot seem to find the issue. I thought I had already closed all the files, and I haven't used the 'malloc' syntax for memory ...
lgtits's user avatar
  • 27
0 votes
1 answer
63 views

ld cannot find -lmpi when building Valgrind from source

I'm trying to build Valgrind 3.21.0 from source, I downloaded the archive here and followed the instructions in the README : Run ./configure Run "make" Run "make install", ...
Antoine Motte's user avatar
2 votes
1 answer
60 views

How do I fix valgrind "conditional jump or move depends on uninitialized value(s)" error?

I have this simple program: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char *str; str = NULL; str = malloc(sizeof(char) * 20); ...
Proth's user avatar
  • 29
0 votes
0 answers
20 views

Display of valgrind results in Jenkins does not look correct

I am running multiple unit tests for a software on different target platforms during a Jenkins build. This includes running Valgrind using the memcheck tool. I use the Valgrind plugin plugin, and use ...
hoboman's user avatar
  • 143
0 votes
0 answers
23 views

Valgrind and containerized ASP.NET Core 7 - How to use it on my production env?

I have an API with a leak that only reproducible on AKS. After exhausting a lot of other tools, I got a suggestion to use Valgrind. The problem is that Valgrind has to launch the process and the ...
Leonardo's user avatar
  • 10.8k
2 votes
2 answers
91 views

How do i deal with this memory leak in this C 90 code?

The code roughly works like this: given in input a matrix and the value of it's columns and rows the algorithm searches the shortest path with a preference for certains cells to move on. Here is the ...
Jacopo V's user avatar
0 votes
1 answer
36 views

Memory leak when copying dom and then replacing node (xmlCopyDoc and xmlReplaceNode)

I am building a program that does a merge validation between two xml files using libxml2 v2.11. In summary, I am creating a copy of a target dom to then replace all nodes with the replacement dom's ...
JoseleMG's user avatar
  • 302
0 votes
0 answers
37 views

How to suppress problems detected by Valgrind with EXPECT_DEBUG_DEATH Google test macro?

I’ve run to the problem with Google unit testing framework and valgrind interaction. When I use EXPECT_DEBUG_DEATH macro and memcheck tests code with valgrind I get massive log output. valgrind --...
Fajlip's user avatar
  • 1
0 votes
2 answers
64 views

MPI_Bcast returns EXIT CODE: 139 on large char arrays

I would appreciate, if you could help me troubleshoot the following situation. I broadcast (on localhost) a char array in 2 consecutive steps: MPI_Bcast the size of the array MPI_Bcast the array ...
user1221647's user avatar
0 votes
0 answers
31 views

valgrind determine which unrecognised instruction

I've been trying to debug a windows game running on Linux (Arch) using wine. I've managed to make the game run but there is a 80% CPU load in idle (login screen), which seems a bit excessive and thus ...
LinG's user avatar
  • 317
1 vote
1 answer
90 views

free() on char* recognized as invalid by valgrind

I am attempting to free char* pointers that exist within a char** array, but valgrind is determining this operation as invalid. Here is a simple example of what I'm doing: struct building{ int ...
smellyourbooks's user avatar
1 vote
1 answer
100 views

Valgrind illegal hardware instruction with Zig

I'm trying to debug the memory using Valgrind for a simple Zig code that leaks memory. This is the code I'm using const std = @import("std"); const Point = struct { x: i32, y: i32, }...
Isky's user avatar
  • 1,338
1 vote
0 answers
39 views

CS50 PSET 4 "Speller" - Having issues freeing allocated memory

I'm programming a spellchecker per CS50's Week 4 problem set, but I ran into an issue. I am leaking memory. :) dictionary.c exists :) speller compiles :) handles most basic words properly :) handles ...
nzo's user avatar
  • 11
0 votes
0 answers
26 views

Is there a way to explicitly ignore speicific API's warnings

Related to my previous question:Valgrind Memory check complains on TessBaseAPI [newline] Could not valgrind test my project for leaks, as valgrind complains for something, I could not understand and ...
JamesQReader's user avatar
0 votes
0 answers
34 views

How do I determine segment errors displayed by valgrind?

Processes running directly and starting through gdb are normal. However when I run it under valgrind, it will crash quickly showing segment errors(without any else information). Is there any good way ...
Arthurian's user avatar
0 votes
1 answer
22 views

why is valgrind ignoring my --error-exitcode option?

I understood that the --error-exitcode option can be used to cause valgrind to return a non-zero exit code when leaks are found. The valgrind documentation says: --error-exitcode= [default: 0] ...
Edward Hartnett's user avatar
0 votes
0 answers
33 views

valgrind errors: --track-origins=yes

When I run valgrind -s on my program it doesn't find any errors, but when I run valgrind -s (...)--track-origins=yes it finds some errors. Is it normal? I thought --track-origins=yes was just supposed ...
Nicolò Tiraboschi's user avatar
0 votes
0 answers
111 views

Why is there a memory leak when calling `g_bus_get_sync` in GLib?

I've got the following code that I've compiled and ran through Valgrind but g_bus_get_sync seems to leak memory. Have I done something wrong? #include <gio/gio.h> #include <libmm-glib.h> ...
Puddler's user avatar
  • 2,649
0 votes
0 answers
51 views

Why does free fail to dealloc memory used for sqlite3 errors?

I have this simple program that opens the data.db and executes a single query, it compiles without any errors or warnings but when running it with valgrind it states that there is memory leak ==1839== ...
misha's user avatar
  • 41
-1 votes
1 answer
69 views

Debugging memory leak problem in parallel code with valgrind

I am debugging a parallel code. I got error indicating index out of range in some map objects. The error message says: **terminate called after throwing an instance of 'std::out_of_range'** **what(): ...
renpo's user avatar
  • 1
2 votes
1 answer
58 views

Getting "Syscall param execve(argv) points to uninitialised byte(s)" in memory leak?

Running the following C program with valgrind --leak-check=yes results in valgrind giving an output indicating that "Syscall param execve(argv) points to uninitialised byte(s)" The following ...
Jonah KIM's user avatar
0 votes
2 answers
58 views

C++ detached thread memory access errors

I'm trying to implement cooperative function timeout cancellation in C++, following recommendations in this answer. The idea is simple: if executing in separate thread function exceedes its allowed ...
Sergey's user avatar
  • 1,176
0 votes
0 answers
45 views

Valgrind closes and prints "Segmentation fault" with no indication of where issue lies

I run my project in GDB without issues. When I run it in Valgrind, however, it consistently closes and prints "Segmentation fault" to the screen at a certain point without any indication of ...
Aelyn's user avatar
  • 37
0 votes
3 answers
79 views

Valgrind reports memory leak from shared object

I have a C program that plays mp3 files with libmpg123 and libao. I use Valgrind to detect memory leak and other potential issues with the following command: valgrind --leak-check=full --show-leak-...
D.J. Elkind's user avatar
0 votes
1 answer
78 views

How do I understand Valgrind error message?

I am a regular C++ developer, but new to Valgrind software. I am facing a problem in my C++ software so that I ran Valgrind. Unfortunately, I could't able to read. Could someone help me to understand ...
surendra kumar A M's user avatar
1 vote
0 answers
64 views

Valgrind Memory error detection on just call to Py_Initialize() and nothing else

I am adding my python code into c++ for making an wrapper to c api that can be later used inside cpp as library and everything is working fine but for except one thing that is memory errors. See ...
Muhammad Awais's user avatar
0 votes
2 answers
37 views

does valgrind support profiling SYCL applications

I'm trying to identify valgrind's support for different Programing languages, I just want to find the valgrind's support for the SYCL applications, if supports how to profile the SYCL Application, If ...
bhuma's user avatar
  • 1
1 vote
1 answer
100 views

Incorrect joint work of Valgrind with GDB

I'm trying to connect Valgrind to GDB. I've written a test code: #include <stdio.h> int main() { int x, i; for (i=0; i < 10; i++) { if (x < 10) printf("...
Fyodor's user avatar
  • 25
0 votes
1 answer
186 views

Connecting valgrind to GDB

The official valgrind documentation(https://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver) provides us with the following instructions: " 3.2. Debugging your program ...
Fyodor's user avatar
  • 25
-2 votes
1 answer
74 views

C++ segmentation fault with fgets (large file, large malloc)

I am scanning a large dump file of coordinates 'out.dump' (~ 9GB) and keep getting a segfault on a line where I use fgets(). I read the file line by line and store it in an array called lines[]. Then, ...
Min Jae Kim's user avatar
1 vote
1 answer
67 views

CS50 Speller Pset working with valgrind but not separately

I'm doing the Pset5 of CS50, "speller", where you have to create a spelling checking program that loads a dictionary into memory, and hashes the words into a hash table. Then it reads a text ...
user75470's user avatar
3 votes
1 answer
223 views

Valgrind memcheck tool showing 0 leaks eventhough there are possible memleaks

I need to investigate memory leaks in my C project. But before that, i just written a sample program and cross compiled to ARM-v8-a 64bit OpenWRT linux platform. With this program, I am trying to ...
renga_in_stack's user avatar
0 votes
1 answer
37 views

Make a valgrind error suppression generic for an object library, with wildcards

Using valgrind in the context of a C++ project, I have been trying to suppress memory leak information coming from third party libraries. I would generate the specific suppression file entry running ...
Antonio's user avatar
  • 19.5k
0 votes
1 answer
40 views

Valgrind reporting invalid read of memory inside alloc'd region

I'm trying to use Valgrind to check for leaks inside my program. It's found a few that were relatively easy to understand (invalid reads outside alloc'd regions), but I'm having trouble understanding ...
MrThud's user avatar
  • 1
0 votes
1 answer
96 views

Valgrind not giving source code line for memory leak

I am using Valgrind, version 3.19.0 on an ARM platform. I wrote a small program that hase a memory leak; here's the source: #include <stdlib.h> int main() { char* p = (char*)malloc(1024 * ...
bui3's user avatar
  • 133
0 votes
1 answer
40 views

Can I use Valgrind to analyze which functions in my program are using the most memory?

I have been given an executable where I have to analyze its memory usage - specifically which functions are using the most memory. I have used Valgrind to perform memory leak checks and analyzing how ...
yeepaa's user avatar
  • 1
0 votes
0 answers
103 views

How can I analyze an executable made for ARM (32 bit) on my x86_64 machine, specifically using Valgrind?

I have been given an executable compiled for ARM (32 bit) and have to use Valgrind to analyze it. However, my machine is x86_64 and Valgrind is by default only installing tools for x86_64. Also, I don'...
yeepaa's user avatar
  • 1
0 votes
0 answers
9 views

What if Valgrind's detected memory loss goes from something to nothing in the course of a process?

If Valgrind summarizes a non-zero amount of memory as "definitely lost" and later summarizes zero memory as "definitely lost" which is it? Did it turn out to be wrong the first ...
J-Kappes's user avatar

1
2 3 4 5
83