| Bug #58522 | mtr --debug leaks memory when test fails | ||
|---|---|---|---|
| Submitted: | 26 Nov 2010 14:19 | Modified: | 20 Dec 2010 3:07 |
| Reporter: | Sven Sandberg | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Tools: MTR / mysql-test-run | Severity: | S3 (Non-critical) |
| Version: | 5.1+, 5.0 | OS: | Any |
| Assigned to: | Bjørn Munch | CPU Architecture: | Any |
| Tags: | memory leak, mtr | ||
[27 Nov 2010 12:08]
Sveta Smirnova
Thank you for the report. Verified as described with versions 5.0 and 5.1 With mysql-trunk test just fails which is expected.
[29 Nov 2010 15:49]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/125377 2956 Bjorn Munch 2010-11-29 Bug #58522 mtr --debug leaks memory when test fails Backported use of setenv() from 5.5 This will remove the leak on systems that have setenv() I have not fixed the string.c leak, it's a local variable that the cleanup function cannot access.
[30 Nov 2010 9:21]
Daniel Fischer
Code looks like it might work. Comment is slightly wrong; according to the standard, setenv() is the interface that leaks and putenv() the one that doesn't. Various actual implementations exist in all possible combinations, so arguably, reliance on the environment for variables is a design error.
[9 Dec 2010 13:42]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/126422 2958 Bjorn Munch 2010-12-09 Bug #58522 mtr --debug leaks memory when test fails Backported use of setenv() from 5.5 This will remove the leak on systems that have setenv() I have not fixed the string.c leak, it's a local variable that the cleanup function cannot access.
[9 Dec 2010 16:23]
Bjørn Munch
Pushed to -mtr trees
[17 Dec 2010 12:48]
Bugs System
Pushed into mysql-5.1 5.1.55 (revid:georgi.kodinov@oracle.com-20101217124435-9imm43geck5u55qw) (version source revid:bjorn.munch@oracle.com-20101209193247-7c4ob7wuy21clt42) (merge vers: 5.1.55) (pib:24)
[17 Dec 2010 12:52]
Bugs System
Pushed into mysql-5.5 5.5.9 (revid:georgi.kodinov@oracle.com-20101217124733-p1ivu6higouawv8l) (version source revid:bjorn.munch@oracle.com-20101209195322-embe21sfutgb3oy0) (merge vers: 5.5.8) (pib:24)
[17 Dec 2010 12:56]
Bugs System
Pushed into mysql-trunk 5.6.1 (revid:georgi.kodinov@oracle.com-20101217125013-y8pb3az32rtbplc9) (version source revid:anitha.gopi@sun.com-20101210041312-50t9adyhwwybsm6x) (merge vers: 5.6.1) (pib:24)
[20 Dec 2010 3:07]
Paul DuBois
Changes to test suite. No changelog entry needed.

Description: When a test fails, and the --debug flag was given to mtr, mtr reports that memory was not freed in some places. How to repeat: $ cd mysql-test $ cat t/bug.test oink; $ ./mtr --debug bug [...] main.bug [ fail ] Test ended at 2010-11-26 14:49:22 CURRENT_TEST: main.bug mysqltest: At line 1: query 'oink' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'oink' at line 1 Warning: Not freed memory segments: 5 Warning: Memory that was not free'ed (368 bytes): 256 bytes at 0x8384f80, allocated at line 39 in 'string.c' 29 bytes at 0x8352708, allocated at line 2123 in 'mysqltest.cc' 24 bytes at 0x8352988, allocated at line 2123 in 'mysqltest.cc' 31 bytes at 0x83528b8, allocated at line 2123 in 'mysqltest.cc' 28 bytes at 0x8352630, allocated at line 2123 in 'mysqltest.cc' Suggested fix: The line numbers look like VAR::env_s is not freed.