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
* [Bug libstdc++/60308] [4.9 Regression] std::deque leaks memory
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 ` glisse at gcc dot gnu.org
2014-02-22 0:14 ` glisse at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-02-22 0:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60308
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-02-22
Ever confirmed|0 |1
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
_M_initialize_map is called twice...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/60308] [4.9 Regression] std::deque leaks memory
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
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-02-22 0:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60308
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Seems to be my fault in r202781:
_Deque_base(const allocator_type& __a)
: _M_impl(__a)
- { }
+ { _M_initialize_map(0); }
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/60308] [4.9 Regression] std::deque leaks memory
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
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-02-22 0:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60308
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
I guess this should take us back to how it worked in 4.8:
--- stl_deque.h (revision 207837)
+++ stl_deque.h (working copy)
@@ -467,7 +467,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Deque_base(const allocator_type& __a)
: _M_impl(__a)
- { _M_initialize_map(0); }
+ { }
#if __cplusplus >= 201103L
_Deque_base(_Deque_base&& __x)
@@ -793,7 +793,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/
explicit
deque(const allocator_type& __a)
- : _Base(__a) { }
+ : _Base(__a, 0) { }
#if __cplusplus >= 201103L
/**
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/60308] [4.9 Regression] std::deque leaks memory
2014-02-21 23:31 [Bug libstdc++/60308] New: [4.9 Regression] std::deque leaks memory ppluzhnikov at google dot com
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-02-22 10:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60308
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
Author: glisse
Date: Sat Feb 22 10:24:11 2014
New Revision: 208041
URL: http://gcc.gnu.org/viewcvs?rev=208041&root=gcc&view=rev
Log:
2014-02-22 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/60308
* include/bits/stl_deque.h (_Deque_base::_Deque_base(const
allocator_type&)): Remove redundant call to _M_initialize_map.
(deque::deque(const allocator_type&)): Initialize _Base with a
constructor that calls _M_initialize_map.
Partial revert:
2013-09-20 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/58338
(_Deque_base) [_Deque_base(const allocator_type&)]: Add missing call to
_M_initialize_map.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/stl_deque.h
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/60308] [4.9 Regression] std::deque leaks memory
2014-02-21 23:31 [Bug libstdc++/60308] New: [4.9 Regression] std::deque leaks memory ppluzhnikov at google dot com
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-02-22 10:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60308
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |glisse at gcc dot gnu.org
Resolution|--- |FIXED
--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
Fixed. Sorry for the break and thanks for the report.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/60308] [4.9 Regression] std::deque leaks memory
2014-02-21 23:31 [Bug libstdc++/60308] New: [4.9 Regression] std::deque leaks memory ppluzhnikov at google dot com
` (4 preceding siblings ...)
2014-02-22 10:28 ` glisse at gcc dot gnu.org
@ 2014-02-22 13:56 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-22 13:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60308
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.9.0
^ 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).