public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: doolin@ce.berkeley.edu
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/9147: Memory leak resulting from std::valarray->push_back(arg)
Date: Thu, 02 Jan 2003 22:36:00 -0000	[thread overview]
Message-ID: <20030102222615.1483.qmail@sources.redhat.com> (raw)


>Number:         9147
>Category:       libstdc++
>Synopsis:       Memory leak resulting from std::valarray->push_back(arg)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 02 14:36:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     doolin@ce.berkeley.edu
>Release:        g++-3.2
>Organization:
>Environment:
GNU/Linux
>Description:
Memory leak in valarray and vg_clientfuncs.c:


dave@dda:~/sf.net/geotechnica/projects/stratsection/test$ !va
valgrind --leak-check=yes --show-reachable=yes ./coltest
==4378== valgrind-1.0.3, a memory error detector for x86 GNU/Linux.
==4378== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==4378== Estimated CPU clock rate is 552 MHz
==4378== For more details, rerun with: -v
==4378== 
Sum: 20
RSum: 20
==4378== 
==4378== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==4378== malloc/free: in use at exit: 2640 bytes in 3 blocks.
==4378== malloc/free: 7 allocs, 4 frees, 2724 bytes allocated.
==4378== For counts of detected errors, rerun with: -v
==4378== searching for pointers to 3 not-freed blocks.
==4378== checked 4400124 bytes.
==4378== 
==4378== definitely lost: 16 bytes in 1 blocks.
==4378== possibly lost:   0 bytes in 0 blocks.
==4378== still reachable: 2624 bytes in 2 blocks.
==4378== 
==4378== 16 bytes in 1 blocks are definitely lost in loss record 1 of 3
==4378==    at 0x4004491B: malloc (vg_clientfuncs.c:100)
==4378==    by 0x40044E84: realloc (vg_clientfuncs.c:262)
==4378==    by 0x4038F83B: (within /lib/libc-2.2.5.so)
==4378==    by 0x4033D166: (within /lib/libc-2.2.5.so)
==4378== 
==4378== 64 bytes in 1 blocks are still reachable in loss record 2 of 3
==4378==    at 0x4004491B: malloc (vg_clientfuncs.c:100)
==4378==    by 0x4033D35F: (within /lib/libc-2.2.5.so)
==4378==    by 0x402C7560: (within /usr/lib/libstdc++.so.5.0.1)
==4378==    by 0x40295420: (within /usr/lib/libstdc++.so.5.0.1)
==4378== 
==4378== 2560 bytes in 1 blocks are still reachable in loss record 3 of 3
==4378==    at 0x40044A0B: __builtin_new (vg_clientfuncs.c:125)
==4378==    by 0x40044A51: operator new(unsigned) (vg_clientfuncs.c:138)
==4378==    by 0x402B81DB: (within /usr/lib/libstdc++.so.5.0.1)
==4378==    by 0x402B80F0: (within /usr/lib/libstdc++.so.5.0.1)
==4378== 
==4378== LEAK SUMMARY:
==4378==    definitely lost: 16 bytes in 1 blocks.
==4378==    possibly lost:   0 bytes in 0 blocks.
==4378==    still reachable: 2624 bytes in 2 blocks.
==4378== 
dave@dda:~/sf.net/geotechnica/projects/stratsection/test$ 
>How-To-Repeat:
Use std::valarray->push_back(arg).

I would be willing to submit an example if I don't get flamed too hard.  If I get some time in a couple of weeks, I may even try to fix it.
>Fix:
Add a call to free() in the appropriate places.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-01-02 22:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-02 22:36 doolin [this message]
2003-01-02 23:01 bkoz
2003-01-02 23:16 David Doolin
2003-01-06 20:39 bkoz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030102222615.1483.qmail@sources.redhat.com \
    --to=doolin@ce.berkeley.edu \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).