Linked Questions
21 questions linked to/from Valgrind: Memory still reachable with trivial program using <iostream>
8 votes
1 answer
4k views
c++ valgrind shows memory leak in hello world [duplicate]
Code of my program is #include <iostream> int main(int argc, const char *argv[]) { std::cout << "hello world!\n"; return 0; } I compiled it with flags -Wpedantic -pedantic-errors -...
1 vote
2 answers
2k views
Memory leak detected by valgrind, but cannot find line where I forget to free [duplicate]
Here is simplified version of the code, I deleted everything that doesn't concern the problem. #include <iostream> #define N 3 int main() { int *input; int **cl; input = new int[...
0 votes
1 answer
437 views
memory leakage when main is empty - Ubuntu/C++ [duplicate]
I'm using an Ubuntu 14.04 image with VmWare, I'm writing a program in C++ & whenever I check the memory with Valgrind, I get a message that I have 1 alloc, with 0 free. The thing is, that I ...
0 votes
0 answers
47 views
Weird alloc by a very simple C++ code [duplicate]
I recently learned about the memory error checking tool, Valgrind. I checked for allocs on some very simple C++ code and found some interesting results which is very weird. For eg., #include<...
0 votes
0 answers
35 views
C++ memory leak in template specialization [duplicate]
I cannot understand what is happening in the following code: template<typename X> class TestClass { public: void alloc(X x) { } }; template<> void TestClass<int>::alloc(int ...
9 votes
1 answer
10k views
Valgrind Error: in use at exit: 72,704 bytes C++ Initialization List weirdness with char*
Issue: I have a weird issue that I wasn't expecting. I have a class called Answers and within the header is this: class Answer { char* aText; bool b_correct; public: Answer():aText(0){;}...
3 votes
1 answer
3k views
cuda call fails in destructor
I am new to CUDA and met a problem when writing a singleton/global variable using CUDA. The singleton allocates some cuda memory and tries to free it in the destructor. However, the destructor crashes ...
3 votes
1 answer
2k views
std::cout causes memory leak
I have a very simple C++ program. #include <iostream> int main() { std::cout << "HI" << std::endl; return 0; } I compile this on a Mac with the command c++ --std=c++11 leak....
4 votes
0 answers
3k views
GLIBCXX_FORCE_NEW and valgrind
I am aware that there has been a lot of questions asked about this, but they are quite old and situation may be different now. I am running fairly new gcc (4.9.2), libstdc++ 3.4.21 and valgrind 3.10.1....
0 votes
2 answers
864 views
Why does this Deque destructor have memory leak
I use doubly linked list to implement Deque in C++. Destructor: Deque::~Deque() { while (this->left_p) { node *temp = this->left_p; this->left_p = this->left_p-&...
1 vote
1 answer
1k views
valgrind shows me a leak when using libxml2
i have a code which i must fix it. It has a leak, I don't know where is the problem, but i think something is bad done. is there anybody who has the same problem and can help me please? ==3923== 32 ...
1 vote
0 answers
2k views
valgrind reporting: still reachable: 72,704 bytes in 1 blocks
I've looked around various bug notes and stackoverflow questions on this matter (link here) but I am still unable to understand whether: is it possible to write my c++ code in such a fashion that it ...
2 votes
1 answer
435 views
Memory leak when storing pointers into vector
I have read multiple similar questions on the same topic that have been asked, but I was not able to resolve my issue by following them. I want to store pointers in a vector, but I see a memory leak. ...
1 vote
1 answer
298 views
How to see heap dynamicly during execution C++
I made a C++ application and I currently test it for memory leaks. On g++ 7.2.0 it has no leaks but on g++ 5.4.0 it does. I have some classes (dynamic data structures) are initialized and used but ...
0 votes
2 answers
472 views
Valgrind memory leaks : callstack not going back to my code
I tend to do a leak-check with valgrind from time to time, just to ensure my code is leak-free. Usually, either it is leak free, or I get some trace to where the leak occurs (ie even if the leak ...