Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#45051 - [valgrind] Valgrind reports unfreed memory for C++ programs

Attached to Project: Arch Linux
Opened by Lukas Wagner (ValidUser) - Friday, 22 May 2015, 20:56 GMT
Last edited by Levente Polyak (anthraxx) - Thursday, 21 December 2017, 13:28 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Anatol Pomozov (anatolik)
Levente Polyak (anthraxx)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No


Valgrind reports unfreed memory for all C++-programs that are linked against the standard library. I believe this issue was introduced after I updated from glibc 2.21-3 to 2.21-4 (I tested this scenario on my laptop that still has 2.21-2 - no issue there)
I could not reproduce the same issue for C programs.

Valgrind output:
==13793== 72,704 bytes in 1 blocks are still reachable in loss record 1 of 1
==13793== at 0x4C29F90: malloc (in /usr/lib/valgrind/
==13793== by 0x4EC01EF: pool (
==13793== by 0x4EC01EF: __static_initialization_and_destruction_0 (
==13793== by 0x4EC01EF: (
==13793== by 0x400F0E9: call_init.part.0 (in /usr/lib/
==13793== by 0x400F1FA: _dl_init (in /usr/lib/
==13793== by 0x4000DB9: ??? (in /usr/lib/
==13793== LEAK SUMMARY:
==13793== definitely lost: 0 bytes in 0 blocks
==13793== indirectly lost: 0 bytes in 0 blocks
==13793== possibly lost: 0 bytes in 0 blocks
==13793== still reachable: 72,704 bytes in 1 blocks
==13793== suppressed: 0 bytes in 0 blocks

Additional info:
* package version(s)
glibc 2.21-4
gcc 5.1.0-4
valgrind 3.10.1-2

Steps to reproduce:
Write simple C++ program (e.g. Hello World)
Compile with g++ main.cpp -o main
Run Valgrind: valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes ./main

This task depends upon

Closed by  Levente Polyak (anthraxx)
Thursday, 21 December 2017, 13:28 GMT
Reason for closing:  Fixed
Additional comments about closing:  we have gcc 7.2.1-2, this is fixed in 6 already
Comment by Anatol Pomozov (anatolik) - Friday, 22 May 2015, 22:51 GMT
Please send this report valgring upstream maillist.
Comment by Hershal Bhave (hershal) - Friday, 29 May 2015, 22:50 GMT
I also have this problem, though it also happens without including iostream. Even a program with just the "return 0" reports 72704 unfreed bytes in 1 block.
Comment by seshu yamajala (syamajala) - Wednesday, 10 June 2015, 11:33 GMT
Any updates on this?
Comment by Lukas Wagner (ValidUser) - Wednesday, 10 June 2015, 13:52 GMT
Sorry for the delay. I was rather busy the past couple days and somehow forgot about this.
I just reported it upstream:
Comment by seshu yamajala (syamajala) - Sunday, 03 April 2016, 08:10 GMT
There seems to be a patch now.
Comment by Anatol Pomozov (anatolik) - Sunday, 03 April 2016, 21:59 GMT
The fix is only for upcoming gcc 6