4,203
questions
0
votes
0
answers
36
views
Facing Memory Allocation Issue in malloc During Function Execution
The error stating that memory cannot be allocated at the same point in malloc with the same number of repetitions keeps occurring.
received signal SIGSEGV, Segmentation fault.
pid_t getPIDByName(const ...
1
vote
1
answer
56
views
Valgrind gives an error "Invalid read of size 4"
I'm reading float data in from a file and Valgrind gives the error "Invalid read of size 4". I'm a new user of Valgrind and don't understand why I get this error.
My code is:
int main()
{
...
0
votes
0
answers
74
views
Double free when trying to free memory allocated in a Chained Hashmap in C
Apologies in advance for the code dump, I can't really think of another way to show my issue properly.
For a school project I have to make a bakery simulation and since it has to fit within certain ...
2
votes
1
answer
79
views
Why does Valgrind report "uninitialized value" but not "invalid read" in my C++ vector access?
I am working on a C++ program that involves accessing elements in a std::vector . I encountered an issue when running my code with Valgrind, where it reports an "uninitialized value" error, ...
5
votes
2
answers
120
views
Is boost::filesystem thread-safe?
Here is the following case I am observing on my Debian stable system:
% valgrind --tool=drd ./threads
==1368067== drd, a thread error detector
==1368067== Copyright (C) 2006-2020, and GNU GPL'd, by ...
0
votes
1
answer
25
views
Valgrind Warning: set address range perms: large range when using -DCMAKE_BUILD_TYPE=DEBUG
I am working with a fortran program (this repository), which I compile using the newest intel LLVM compiler. This works fine when I don't supply any flags, but when I compile with -DCMAKE_BUILD_TYPE=...
1
vote
1
answer
55
views
Conditional jump or move depends on uninitialised value(s) ADT Set [closed]
I have been trying to implement a Set ADT using open addressing for the hash table and lazy deletion, however, I am having problems with the resizing of the Set.
I can insert elements up to 75% of the ...
0
votes
2
answers
56
views
Make a valgrind error suppression generic for a system call
Using valgrind in the context of a C++ project, I have been trying to suppress uninitialised byte information coming from system calls within third party libraries. How could I generate the specific ...
1
vote
0
answers
44
views
Is GLFWTerminate Leaking Memory?
I have been using GLFW in a recent project of mine, and felt it was necessary to run the code through Valgrind for a leak check. However, when I did, two memory leaks were reported during the close of ...
0
votes
1
answer
66
views
valgrind unhandled instruction bytes / Unrecognised instruction
I want to check my C++ application in valgrind as I get weird crashes on some machines, but not on my machine which I use for developing. But I cannot get anywhere. Right as the application starts up ...
0
votes
0
answers
67
views
SDL huge memory leaks [duplicate]
I found a huge memory leak in the initialisation of SDL. So I wrote a basic code to test SDL:
#include <SDL2/SDL.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
if (SDL_Init(...
0
votes
0
answers
59
views
Valgrind shows weird results when using it with SDL2
I am writing an additional layer on SDL2 for personal use. I'd like to check for memory leaks, so I downloaded Valgrind and read a quick start page.
I launched a program that uses my library in ...
0
votes
0
answers
56
views
My binary is not establishing SCTP connection when running using Valgrind
In my program two binaries are there, one binary [let's call it binary1] is trying to establish SCTP connection with the other binary[let's call it binary2].
In normal condition binary1 is able to ...
0
votes
0
answers
51
views
kcachegrind can't connect to display
For a school project I have to use Valgrind and other tools to help optimise a program. I'm on macOS 14.0 and using a Lima VM to run the profiling tools, but this is my first time using an environment ...
1
vote
1
answer
136
views
Difference in Memory Usage Between malloc and new in C++
I'm observing a difference in the total memory allocation when using malloc versus new in a simple C++ program, as reported by Valgrind. Below are the two versions of my program and the corresponding ...
1
vote
1
answer
112
views
Mergesort for singly-linked lists gives correct results but leaks memory
I'm working on an assignment to implement mergesort for singly-linked lists in C++. The merge function needs to merge two sorted lists in-place without creating new nodes. The mergesort function ...
1
vote
1
answer
67
views
Valgrind is still showing memory is reachable with addrec() [closed]
The following code is for creating and managing hash table:
hash.c:
#include <stdio.h>
#include <stdlib.h>
#include "hash.h"
typedef struct node {
record_t rec;
struct ...
0
votes
2
answers
115
views
How to detect Out-of-Bounds Access within Placement New Boundaries in C++?
#include <iostream>
struct mix {
int64_t x[10];
};
int main() {
int64_t* p = new int64_t[100];
mix* px = new (p) mix;
mix* py = new (p + 10) mix;
px->x[12] = 104;
std::cout <&...
0
votes
1
answer
23
views
double free or corruption (out), coredump. Where can I find the coredump?
I have been working in Fedora on a C++ client for the BaseX XML database. The original version of the client was developed in Eclipse and consisted of a test program and some source files that allowed ...
0
votes
1
answer
40
views
Valgrind Massif - startpoint for memory allocation [cpp]
I just started getting in touch with Valgrinds massif tool and wanted to know, if one could introduce a checkpoint to start monitoring the heap allocation.
Considering the following basic example:
#...
0
votes
1
answer
34
views
--trace-children-skip option is not having any impact with Valgrind
I have a run.sh with: ./opt/exm/bin/exm_daemon
exm_daemon spawns many process.
I run valgrind with options:
sudo valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --trace-children=...
1
vote
0
answers
41
views
Why is Callgrind not working on my project?
I tried using callgrind on my program written in C language but it is not working. This is the output it gives me when I try to launch it:
(https://i.sstatic.net/pBeyJRYf.png)
It was working before, ...
0
votes
1
answer
64
views
Valgrind complain after modifing reference return variable from a vector in c++
I am trying to modify an std::vector through the use of references, the vector lifetime is designed in such a way modifications through the reference always are valid, in other words the the reference'...
0
votes
0
answers
269
views
Valgrind fatal error at startup in arch linux
I installed valgrind on my arch system through
sudo pacman -S valgrind
and when attempting to run it, this message appears:
==3821== Memcheck, a memory error detector
==3821== Copyright (C) 2002-2024,...
0
votes
0
answers
38
views
Build valgrind to target LPC55S69(which is based on Armv8-m architecture)
I'm trying to build valgrind to target baremetal arm cortex-m (based on armv8-m architecture). The host is a x86 wsl environment. How do I specify this while trying to configure valgrind.
For ex: To ...
2
votes
1
answer
87
views
Unable to debug python C extension using valgrind
I am trying to debug a C extension I made using CFFI. I am using Python 3.11 and Valgrind 3.18.1.
As far as I can tell from the docs the only setup needed is setting the PYTHONMALLOC=malloc ...
0
votes
1
answer
77
views
Valgrind stack measurement
I would like to clarify some points about using Valgrind soft in order to measure stack usage size.
I'm using Linux OS. My main program is written on C++ and using 3-d party shared libraries(some ...
0
votes
1
answer
59
views
Enable/disable flags when doing a valgrind build
I have two targets in my Makefile, namely:
all: $(TARGET)
valgrind: $(TARGET)
...
...
...
The valgrind target simply runs the executable with the valgrind program. The CFLAGS for this ...
0
votes
2
answers
61
views
Valgrind (C): Process terminating with default action of signal 11 (SIGSEGV)
I am doing a school project on AVL tree in C. And the code is presenting the following errors. It compiles nicely but it is terminating with Segmentation fault (core dumped).
==210456== Invalid read ...
0
votes
0
answers
39
views
How to apply larger memory for Valgrind
I use Valgrind to check memleak in my project -- a trading system server. When the memory database size configured on the server is large (64G or more), valgrind will exit when I start detecting.
How ...
0
votes
1
answer
99
views
EGL memory leak
I've been told EGL is a good choice to render graphics in wayland window.
I'm not yet convinced and I still don't know if (except vulkan) it is the only way
to have some openGL magic in a wayland ...
0
votes
0
answers
58
views
Unexpected double free in single linked list
`I am trying to do a simple linked list. Everything works fine, but after the program calls ~List()
I am getting "double free in tcache2" and SIGABRT every time I run the program and ...
0
votes
0
answers
32
views
Valgrind massif shows ??? for simple c++ program compiled with -g
I have ran the C example provided in massif docs https://valgrind.org/docs/manual/ms-manual.html and it works as expected. However it shows??? for this simple c++ program.
main.cc
#include <string&...
0
votes
1
answer
48
views
valgrind shows memory leak in my program in c (two versions)
int main()
{
double (*arr)[COLS] = (double*)malloc(sizeof(*arr) * ROWS);
assert(arr!= NULL);
for (int i = 0; i < ROWS; i++)
{
for (int j = 0; j < COLS; j++)
{...
0
votes
1
answer
44
views
Invalid write trying to allocate a 2D sheet of structures
My allocution of memory is incorrect and therefore i got a seg fault. I want to create a board game represented by a 2D sheet of cases (structures).
For the context, i'm coding a game of Tetris. The ...
0
votes
0
answers
61
views
How to debug memory leaks when using DearImGUI with valgrind
I'm trying to detect memory leaks in my program by using valgrind, so I run:
valgrind ./MCU_EMULATOR --leak-check=full
the program consists of a GUI, but when running with valgrind the GUI never pops ...
0
votes
1
answer
101
views
Why do I keep getting a Valgrind set address range perms warning in my code?
I don't see what I could possibly be doing wrong to keep getting this valgrind error. I'm not leaking any memory..
In my project, I have to implement a graph, a fundamental graph algorithm, and have a ...
-2
votes
1
answer
111
views
Why is my program spending 79.26% of its time in _dl_start?
I'm trying to profile a C++ program with callgrind, and I was certainly not expecting it to spend most of its time opening dynamic libraries.
I don't see any of the functions that I know to take time (...
0
votes
1
answer
122
views
Is there any way to use valgrind from C/C++ via the API?
I want to write tool, that collects different runtime information about executable including heap information. Valgrind is perfect tool to get such info. The key information, that I want to obtain is ...
0
votes
1
answer
123
views
Weird memory leak in Valgrind in a print function
So this is a C script for managing parking lots, and I have this struct:
typedef struct {
char name[MAXSIZE];
int capacity;
char car_plates[MAXREGISTRATIONS][PLATE_SIZE];
char ...
0
votes
0
answers
84
views
Error Using Valgrind's callgrind and kcachegrind on a C++
I've been trying to analyze a simple C++ program that uses fork() to create a child process. The program compiles and runs fine. But, when I try to use Valgrind's callgrind tool to profile the program,...
1
vote
0
answers
65
views
How to correctly rebuild a C++ project as a Debug using CMake for further profiling with Valgrind?
I have a C++ project that I previously built using CMake. Now I need to rebuild it as Debug so that I can profile it with Valgrind to find code bottlenecks. However, I have a problem with the rebuild.
...
-1
votes
1
answer
73
views
Valgrind error when loading font in SFML project
This code:
// g++ sfml.cpp -o sfml_test -lsfml-graphics -lsfml-window -lsfml-system
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::Font font;
if (!font....
1
vote
1
answer
192
views
Why does version 3.22.0 of Valgrind-based Helgrind thread error detector reports data races and version 3.18.1 does not?
1.Background
The following C++ code from cppreference.com illustrates how std::condition_variable is used in combination with a std::mutex to facilitate inter-thread communication.
#include <...
0
votes
0
answers
20
views
Filtering callgrind capture based on shared library name
I would like to have a coarse filter for my callgrind output.
If I ask callgrind to capture a run, I want to tell it to prune at a .so level.
For instance, I would like to tell it that it should not ...
1
vote
1
answer
75
views
C Program runs but GDB fails before main. Using GSL
I am writing a C program that loads two tables as matrices to perform operations on using the open-source GSL library. When compiled, the program prompts for the two files needed and enters an ...
1
vote
0
answers
216
views
Thread #1: Bug in libpthread: sem_wait succeeded on semaphore without prior sem_post
I'm having an error feedback from Helgrind Thread #1: Bug in libpthread: sem_wait succeeded on semaphore without prior sem_post. This is for an exercise where I'm limited in the functions I can use ...
0
votes
1
answer
30
views
Valgrind and wildcard?
According to the valgrind docs:
Locations may be names of either shared objects, functions, or source lines. They begin with obj:, fun:, or src: respectively. Function, object, and file names to ...
0
votes
1
answer
32
views
Understanding stack matching rules for custom suppressions
I applied Valgrind over some C/C++ processes of mine, containing a lot of errors coming from libraries I'm not interested in and that I'd like to suppress. Let's call them banned libraries. The ...
1
vote
1
answer
106
views
Can't detect a memory leak
I wrote a program to search for the longest sentence in several text files:
/* lngst_sentence_file_competition.c */
#include <stdio.h>
#include <stdlib.h>
enum consts {
str_len = 5
};...