cstricker
03-22-2007, 11:38 AM
Dear all,
I want to open a large number of files (50-100) in a 64-bit C++ program. When compiled under debug using the architecture i386 in Xcode, it runs fine. However, when the architecture flag is set to x86_64 and compilation is under relase, then I get a segmentation fault after the 18th fopen-statement.
the main program I use is
using namespace std;
int main (int argc, char * const argv[]) {
ofstream datafile1("file1");
cout<<endl<<"\n done file1..."<<endl;
ofstream datafile1("file2");
cout<<endl<<"\n done file2..."<<endl;
// and so on until
ofstream datafile1("file50");
cout<<endl<<"\n done file50..."<<endl;
return 0;
}
Anyone knows whether this is a known bug in gcc/Xcode??? It seems that it was a bug in older 32 bit gcc versions....
any hint is appreciated!
Chris
I want to open a large number of files (50-100) in a 64-bit C++ program. When compiled under debug using the architecture i386 in Xcode, it runs fine. However, when the architecture flag is set to x86_64 and compilation is under relase, then I get a segmentation fault after the 18th fopen-statement.
the main program I use is
using namespace std;
int main (int argc, char * const argv[]) {
ofstream datafile1("file1");
cout<<endl<<"\n done file1..."<<endl;
ofstream datafile1("file2");
cout<<endl<<"\n done file2..."<<endl;
// and so on until
ofstream datafile1("file50");
cout<<endl<<"\n done file50..."<<endl;
return 0;
}
Anyone knows whether this is a known bug in gcc/Xcode??? It seems that it was a bug in older 32 bit gcc versions....
any hint is appreciated!
Chris