- To: gcc-help@xxxxxxxxxxx
- Subject: High memory usage when compiling array of shared_ptr in gcc 4.6.2+
- From: Philipp Savun <philipp.savun@xxxxxx>
- Date: Fri, 06 Apr 2012 13:56:08 +0200
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Openpgp: url=http://keyserver.veridis.com:11371
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19
Hello,
since version 4.6.2 I have the following problem when compiling a c++11
program with gcc:
When using an array with really many shared_ptr I am running out of
memory when compiling the code.
The the following error occurs:
"cc1plus: out of memory allocating 268435456 bytes after a total of
40083456 bytes"
on my computer having 4GM RAM.
This problem still exitst with gcc 4.7.
gcc 4.5.2 doesn't seem to use much memory at all - it also instantly
compiles that code (and much faster).
Someone who can explain the issue?
The code would be something like this:
#include <memory>
#include <array>
class SomeClass;
typedef std::shared_ptr<SomeClass> SomeClassPtr;
typedef std::array<SomeClassPtr, 3000*3000> MyArray;
int main()
{
MyArray myArray;
return 0;
}
This is the coomandline when compiling:
g++ main.cpp -std=c++0x
My system is "Linux Mint 11 Katya".
Thank you
Philipp
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]