public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/60308] New: [4.9 Regression] std::deque leaks memory
@ 2014-02-21 23:31 ppluzhnikov at google dot com
  2014-02-22  0:03 ` [Bug libstdc++/60308] " glisse at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2014-02-21 23:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60308
           Summary: [4.9 Regression] std::deque leaks memory
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

std::deque currently leaks memory. Test case:

#include <deque>

int main()
{
  for (int j = 0; j < 10; ++j)
    {
      const int ia[] = { 2, 3, 1, 4, 2, 1, 3, 0 };
      std::deque<int> d(ia, ia + sizeof (ia) / sizeof (ia[0]));
    }
}

Using current trunk:
g++ (GCC) 4.9.0 20140221 (experimental)

g++ -g t.cc

Valgrind says:
 valgrind --leak-check=yes ./a.out


==24027== HEAP SUMMARY:
==24027==     in use at exit: 5,760 bytes in 20 blocks
==24027==   total heap usage: 40 allocs, 20 frees, 11,520 bytes allocated
==24027== 
==24027== 5,760 (640 direct, 5,120 indirect) bytes in 10 blocks are definitely
lost in loss record 2 of 2
==24027==    at 0x402F2A9: operator new(unsigned long)
(valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:298)
==24027==    by 0x401531: __gnu_cxx::new_allocator<int*>::allocate(unsigned
long, void const*) (/gcc-svn-install/include/c++/4.9.0/ext/new_allocator.h:104)
==24027==    by 0x4011C3: std::_Deque_base<int, std::allocator<int>
>::_M_allocate_map(unsigned long)
(/gcc-svn-install/include/c++/4.9.0/bits/stl_deque.h:549)
==24027==    by 0x400DDC: std::_Deque_base<int, std::allocator<int>
>::_M_initialize_map(unsigned long)
(/gcc-svn-install/include/c++/4.9.0/bits/stl_deque.h:594)
==24027==    by 0x400B54: std::_Deque_base<int, std::allocator<int>
>::_Deque_base(std::allocator<int> const&)
(/gcc-svn-install/include/c++/4.9.0/bits/stl_deque.h:470)
==24027==    by 0x400A27: std::deque<int, std::allocator<int> >::deque<int
const*>(int const*, int const*, std::allocator<int> const&)
(/gcc-svn-install/include/c++/4.9.0/bits/stl_deque.h:909)
==24027==    by 0x40094C: main (/tmp/t.cc:8)
==24027== 
==24027== LEAK SUMMARY:
==24027==    definitely lost: 640 bytes in 10 blocks
==24027==    indirectly lost: 5,120 bytes in 10 blocks
==24027==      possibly lost: 0 bytes in 0 blocks
==24027==    still reachable: 0 bytes in 0 blocks
==24027==         suppressed: 0 bytes in 0 blocks

Same test shows no leaks with gcc-4.8:
g++ (GCC) 4.8.3 20140109 (prerelease)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-22 13:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-21 23:31 [Bug libstdc++/60308] New: [4.9 Regression] std::deque leaks memory ppluzhnikov at google dot com
2014-02-22  0:03 ` [Bug libstdc++/60308] " glisse at gcc dot gnu.org
2014-02-22  0:14 ` glisse at gcc dot gnu.org
2014-02-22  0:20 ` glisse at gcc dot gnu.org
2014-02-22 10:24 ` glisse at gcc dot gnu.org
2014-02-22 10:28 ` glisse at gcc dot gnu.org
2014-02-22 13:56 ` rguenth at gcc dot gnu.org

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).