Bug 1312647 - reports false positive leaks for C++ STL or string class objects
reports false positive leaks for C++ STL or string class objects
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: valgrind (Show other bugs)
rawhide
All Linux
unspecified Severity medium
: ---
: ---
Assigned To: Mark Wielaard
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-28 07:20 EST by Björn 'besser82' Esser
Modified: 2016-04-08 13:01 EDT (History)
4 users (show)

See Also:
Fixed In Version: valgrind-3.11.0-18.fc23 valgrind-3.11.0-18.fc24 valgrind-3.11.0-19.fc24
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-04-08 13:01:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Valgrind supression rule for leaks in C++ STL and string classes (2.20 KB, text/plain)
2016-02-28 07:20 EST, Björn 'besser82' Esser
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
KDE Software Compilation 345307 None None None 2016-03-01 08:14 EST
GNU Compiler Collection 69945 None None None 2016-03-01 08:13 EST

  None (edit)
Description Björn 'besser82' Esser 2016-02-28 07:20:43 EST
Created attachment 1131251 [details]
Valgrind supression rule for leaks in C++ STL and string classes

Description of problem:

Some programs are using the C++ STL and string classes.
Valgrind reports 'still reachable' memory leaks involving these classes at the exit of the program, but there should be none.


Version-Release number of selected component (if applicable):

Any in all maintained releases, including RHEL.


How reproducible:

100%


Steps to Reproduce:

1. Build a simple C++-program which uses any random STL and/or string-class.
2. Run it using `valgrind --leak-check=full --show-leak-kinds=all`.
3. See a memory-leak similar to the below example.


Actual results:

72,704 bytes in 1 blocks are still reachable in loss record 1 of 1
  at 0x4C28D06: malloc (vg_replace_malloc.c:299)
  by 0x50C317F: ??? (in /usr/lib64/libstdc++.so.6.0.21)
  by 0x400F759: call_init.part.0 (dl-init.c:72)
  by 0x400F86A: call_init (dl-init.c:30)
  by 0x400F86A: _dl_init (dl-init.c:120)
  by 0x4000CB9: ??? (in /usr/lib64/ld-2.22.so)

HEAP SUMMARY:
    in use at exit: 72,704 bytes in 1 blocks
  total heap usage: 4 allocs, 3 frees, 72,864 bytes allocated

LEAK SUMMARY:
   definitely lost: 0 bytes in 0 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 0 bytes in 0 blocks
   still reachable: 72,704 bytes in 1 blocks
        suppressed: 0 bytes in 0 blocks


Expected results:

HEAP SUMMARY:
    in use at exit: 0 bytes in 0 blocks
  total heap usage: 4 allocs, 4 frees, 0 bytes allocated

All heap blocks were freed -- no leaks are possible

At least the false positive report of Valgrind should be suppressed by default.supp.


Additional info:

Many implementations of the C++ standard libraries use their own memory pool allocators.  Memory for quite a number of destructed objects is not immediately freed and given back to the OS, but kept in the pool(s) for later re-use.  The fact that the pools are not freed at the exit of the program cause Valgrind to report this memory as still reachable.

The behavior not to free pools at the exit could be called a bug of the library though.


Suggested solution:

Add the attached suppression-rule (and brief explanation) to default.supp.
Comment 1 Mark Wielaard 2016-03-01 08:13:35 EST
Thanks. This might be a good temporary fix for the issue.
Longer term I think we want valgrind and libstdc++ to coordinate more about these memory pools and cleanup at process exit. There are already some proposed patches for that:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69945
https://bugs.kde.org/show_bug.cgi?id=345307
Comment 2 Fedora Update System 2016-03-15 14:39:34 EDT
valgrind-3.11.0-18.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-ba7dc44867
Comment 3 Fedora Update System 2016-03-15 14:44:41 EDT
valgrind-3.11.0-18.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-0186345d7f
Comment 4 Fedora Update System 2016-03-15 17:29:29 EDT
valgrind-3.11.0-18.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-ba7dc44867
Comment 5 Fedora Update System 2016-03-16 11:22:50 EDT
valgrind-3.11.0-18.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-0186345d7f
Comment 6 Fedora Update System 2016-03-24 21:24:26 EDT
valgrind-3.11.0-18.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 7 Fedora Update System 2016-03-26 14:05:51 EDT
valgrind-3.11.0-18.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2016-04-04 03:50:16 EDT
valgrind-3.11.0-19.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-3f04546964
Comment 9 Fedora Update System 2016-04-04 15:22:41 EDT
valgrind-3.11.0-19.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-3f04546964
Comment 10 Fedora Update System 2016-04-08 13:01:49 EDT
valgrind-3.11.0-19.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.