The following program:
#include <set> #include <iostream> std::set<std::string> Foo() { std::set<std::string> ret; ret.insert("test"); return ret; } int main(int argc, char** argv) { while (true) { for(auto& s : Foo()) { // do nothing. } } return 0; }
Leaks memory and causes my system to swap after a few seconds. This is on Linux x86_64, ICC Version 17.0.1, GCC Version 6.3.0. I compile like this:
icpc -o test test.C
Compiling the same program with g++ does not show this leak. Any ideas? Is there a bug in the compiler?
Thread Topic:
Bug Report