public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/54307] New: [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers
@ 2012-08-17 21:43 matt at use dot net
  2012-08-17 22:59 ` [Bug libstdc++/54307] " hjl.tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: matt at use dot net @ 2012-08-17 21:43 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54307
           Summary: [4.7 regression] increases in memory usage by some
                    C++11 (and C++03) standard containers
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: matt@use.net


Between 4.6 and 4.7.x, the memory used by a few standard containers has
increased, resulting in some OOM and performance issues on an amd64 application
I work on.

4.7:
list<int> size     = 24
unordered_map<int,int> size     = 64
unordered_set<int,int> size     = 64

4.6:
list<int> size     = 16
unordered_map<int,int> size     = 56
unordered_set<int,int> size     = 56

comparing to VC11:
list<int> size   = 16
unordered_map<int,int> size     = 64
unordered_set<int,int> size     = 64

compile commandline is just -std=c++0x. testcase program below:

#include <vector>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <queue>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <hash_map>
#include <hash_set>
#include <unordered_map>
#include <unordered_set>
#include <string>

using namespace std;

int main(void)
{
    vector<int> v; printf("vector<int> size\t = %d\n", sizeof(v));
    array<int,5> a; printf("array<int,5> size\t = %d\n", sizeof(a));
    deque<int> d; printf("deque<int> size\t = %d\n", sizeof(d));
    forward_list<int> f; printf("forward_list<int> size\t = %d\n", sizeof(f));
    list<int> l; printf("list<int> size\t = %d\n", sizeof(l));
    queue<int> q; printf("queue<int> size\t = %d\n", sizeof(q));
    stack<int> s; printf("stack<int> size\t = %d\n", sizeof(s));
    tuple<int,int,int> t; printf("tuple<int,int,int> size\t = %d\n",
sizeof(t));
    map<int,int> m; printf("map<int,int> size\t = %d\n", sizeof(m));
    set<int> set; printf("set<int> size\t = %d\n", sizeof(set));
    unordered_map<int,int> um; printf("unordered_map<int,int> size\t = %d\n",
sizeof(um));
    unordered_set<int> us; printf("unordered_set<int,int> size\t = %d\n",
sizeof(us));
    string str; printf("string size\t = %d\n", sizeof(string));
    return 0;
}


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

* [Bug libstdc++/54307] [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers
  2012-08-17 21:43 [Bug libstdc++/54307] New: [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers matt at use dot net
@ 2012-08-17 22:59 ` hjl.tools at gmail dot com
  2012-08-18  0:05 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2012-08-17 22:59 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-08-17
   Target Milestone|---                         |4.7.2
     Ever Confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-08-17 22:59:26 UTC ---
I believe it has been fixed on 7.2 branch by

http://gcc.gnu.org/ml/gcc-cvs/2012-07/msg00090.html

Can you verified it?


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

* [Bug libstdc++/54307] [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers
  2012-08-17 21:43 [Bug libstdc++/54307] New: [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers matt at use dot net
  2012-08-17 22:59 ` [Bug libstdc++/54307] " hjl.tools at gmail dot com
@ 2012-08-18  0:05 ` paolo.carlini at oracle dot com
  2012-08-21 17:27 ` matt at use dot net
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-18  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-18 00:05:37 UTC ---
Note that the unordered containers have been profoundly reworked to conform to
C++11, the size isn't going to change.


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

* [Bug libstdc++/54307] [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers
  2012-08-17 21:43 [Bug libstdc++/54307] New: [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers matt at use dot net
  2012-08-17 22:59 ` [Bug libstdc++/54307] " hjl.tools at gmail dot com
  2012-08-18  0:05 ` paolo.carlini at oracle dot com
@ 2012-08-21 17:27 ` matt at use dot net
  2012-08-21 17:35 ` paolo.carlini at oracle dot com
  2012-09-07 10:35 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: matt at use dot net @ 2012-08-21 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Matt Hargett <matt at use dot net> 2012-08-21 17:26:55 UTC ---
Paolo, what about list<int>? Does VC11 achieve the size GCC 4.6 has by not
being compliant somehow?


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

* [Bug libstdc++/54307] [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers
  2012-08-17 21:43 [Bug libstdc++/54307] New: [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers matt at use dot net
                   ` (2 preceding siblings ...)
  2012-08-21 17:27 ` matt at use dot net
@ 2012-08-21 17:35 ` paolo.carlini at oracle dot com
  2012-09-07 10:35 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-21 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-21 17:35:25 UTC ---
I have no idea what they are doing in their implementation, there are of course
trade offs. When we decide to globally break the ABI to implement a C++11
Standard Conforming std:list we mean to add a data member to provide an O(1)
list<>::size(), that is what we already "experimented" in 4.7.0. Unless of
course over the next months somebody suggests something else which goes well
together with our other design choices.


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

* [Bug libstdc++/54307] [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers
  2012-08-17 21:43 [Bug libstdc++/54307] New: [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers matt at use dot net
                   ` (3 preceding siblings ...)
  2012-08-21 17:35 ` paolo.carlini at oracle dot com
@ 2012-09-07 10:35 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-07 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-07 10:35:04 UTC ---
I believe this change has been reverted for 4.7.2.


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

end of thread, other threads:[~2012-09-07 10:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-17 21:43 [Bug libstdc++/54307] New: [4.7 regression] increases in memory usage by some C++11 (and C++03) standard containers matt at use dot net
2012-08-17 22:59 ` [Bug libstdc++/54307] " hjl.tools at gmail dot com
2012-08-18  0:05 ` paolo.carlini at oracle dot com
2012-08-21 17:27 ` matt at use dot net
2012-08-21 17:35 ` paolo.carlini at oracle dot com
2012-09-07 10:35 ` 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).