Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

std::string in static array causes very slow compile and/or compiler crash

jcoffland
Beginner
465 Views
A simple example, which I've attached, causes the Intel compiler (11.1 059 Linux) to take a very long time to compile, use a lot of memory and in some cases crash. I've also observed the same problems in the Intel complier for windows.

[shell]$ time icpc -o string_in_array string_in_array.cpp
Fatal compilation error: Out of memory asking for 36872.
compilation aborted for string_in_array.cpp (code 1)

real 3m51.597s
user 3m46.946s[/shell]
However, with gcc it's fine:

[cpp]$ time g++ -o string_in_array string_in_array.cpp 

real	0m14.287s
user	0m12.877s
sys	0m0.800s
[/cpp]
If I compile with no optimization it's a little better:

[cpp]$ time icpc -o string_in_array string_in_array.cpp -O0

real	3m20.380s
user	3m17.324s
sys	0m1.276s
[/cpp]
However, it uses 350MB of RAM and 100% cpu for 3m 20s. That's 14x slower than gcc.
0 Kudos
2 Replies
JenniferJ
Moderator
465 Views

Thanks for your report and the testcase.

I can see the problem on Windows as well. the icl never finish the compilation and run out of memory at the end.

I'll file a bug report to the compiler team. and will let you know when there's a fix or work-around.

Thanks,
Jennifer

0 Kudos
JenniferJ
Moderator
465 Views

When I tested on Windows, I added /EHsc for handling exception. That caused the out of memory. Without /EHsc, icl can compile fine with "-O2" or "-O3".

This test is very extreme, I'm wondering if you have such code in your real application. Could you let me know? So we can treat it properly.

Thanks,
Jennifer
0 Kudos
Reply