public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nanjiang dot shu at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/27615]  New: memory leak with  libstdc++  set <string>
Date: Mon, 15 May 2006 15:28:00 -0000	[thread overview]
Message-ID: <bug-27615-12688@http.gcc.gnu.org/bugzilla/> (raw)

I used  set <string> ss 
as a containtor for a list of unique, ordered strings. However, program
reports segmentation error when trying to allocate a block of memory. 

I have used libcwd to debug the memory allocation, the libcwd detected
memory leaks:
+-----------------------------------------------------------------------------+
|MALLOC  : operator new (size = 1088) = 0x83a2a18                             |
|libstdc++.so.5:_ZNSt24__default_alloc_templateILb1ELi0EE14_S_chunk_allocEjRi]|
|  * WARNING : Memory leak detected!                                          |
|    *           0x83a2a18 std::__default_alloc_template<true,                |
|    *           0>::_S_chunk_alloc(unsigned int, int&) <unknown type>;  (sz  |
|    *           = 1088)                                                      |
+-----------------------------------------------------------------------------+

Memory leak problem solved by changing 
Set <string> ss  ==>   set <char*> ss
However, I'm not sure if this only solves the problem temporary, since
set <string> does not result in memory leaks in most cases. 

Program was compiled by  
g++ -g3 src.cpp  -o prog -lm 
~


-- 
           Summary: memory leak with  libstdc++  set <string>
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nanjiang dot shu at gmail dot com
 GCC build triplet: i586-mandrake-linux-gnu
  GCC host triplet: i686-mandrake-linux-gnu
GCC target triplet: i586-mandrake-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27615


             reply	other threads:[~2006-05-15 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-15 15:28 nanjiang dot shu at gmail dot com [this message]
2006-05-15 15:35 ` [Bug libstdc++/27615] " pinskia at gcc dot gnu dot org
2006-05-15 15:50 ` nanjiang dot shu at gmail dot com
2006-05-15 16:47 ` pcarlini at suse dot de
2006-08-15 18:23 ` pinskia at gcc dot gnu dot org

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=bug-27615-12688@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).