From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14075 invoked by alias); 7 Feb 2014 06:49:55 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 14046 invoked by uid 48); 7 Feb 2014 06:49:53 -0000 From: "dje at google dot com" To: gdb-prs@sourceware.org Subject: [Bug exp/16537] New: operator+ with strings leaks memory Date: Fri, 07 Feb 2014 06:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: exp X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dje at google dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q1/txt/msg00146.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16537 Bug ID: 16537 Summary: operator+ with strings leaks memory Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: exp Assignee: unassigned at sourceware dot org Reporter: dje at google dot com Created attachment 7397 --> https://sourceware.org/bugzilla/attachment.cgi?id=7397&action=edit revised testcase that includes string operator+ Playing with this patch, and extending the testcase to use a string-like class I see the value being leaked. https://sourceware.org/ml/gdb-patches/2014-02/msg00005.html Attached my revised version of the testcase in the above patch. Here is the script I used to exercise it. Compare valgrind output with n = 100 vs n = 1000. valgrind gdb --batch -x loop.gdb n = 100 ==42852== LEAK SUMMARY: ==42852== definitely lost: 2,216 bytes in 108 blocks ==42852== indirectly lost: 24 bytes in 1 blocks ==42852== possibly lost: 458,155 bytes in 3,259 blocks ==42852== still reachable: 6,622,967 bytes in 15,678 blocks ==42852== suppressed: 0 bytes in 0 blocks n = 1000 ==42859== LEAK SUMMARY: ==42859== definitely lost: 13,016 bytes in 1,008 blocks ==42859== indirectly lost: 24 bytes in 1 blocks ==42859== possibly lost: 458,155 bytes in 3,259 blocks ==42859== still reachable: 6,622,967 bytes in 15,678 blocks ==42859== suppressed: 0 bytes in 0 blocks ---snip--- file testsuite/gdb.python/py-value-cc start b 131 c py s1 = gdb.parse_and_eval ("s1") py s2 = gdb.parse_and_eval ("s2") set $i = 0 set $n = 1000 while $i < $n py s3 = s1 + s2 set $i = $i + 1 end -- You are receiving this mail because: You are on the CC list for the bug.