summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2009-12-28 18:27:18 -0500
committerMathias Stearn <mathias@10gen.com>2009-12-28 18:27:18 -0500
commitafbe8c64d9fe1e36a302f5264d82462b200056f1 (patch)
tree90923e3f45300f47de85a15e9bfd574dbe8e2872 /tools
parent315995b8c7e3a5bd55d0248535bf5742bd7bdb7f (diff)
downloadmongo-afbe8c64d9fe1e36a302f5264d82462b200056f1.tar.gz
Allocate line buffer on heap to avoid blowing the stack on windows. SERVER-410
Diffstat (limited to 'tools')
-rw-r--r--tools/import.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/import.cpp b/tools/import.cpp
index 9b43e4fa7fc..47cbe32c998 100644
--- a/tools/import.cpp
+++ b/tools/import.cpp
@@ -201,13 +201,13 @@ public:
log(1) << "filesize: " << fileSize << endl;
ProgressMeter pm( fileSize );
const int BUF_SIZE = 1024 * 1024 * 4;
- char line[ (1024 * 1024 * 4) + 128];
+ boost::scoped_array<char> line(new char[BUF_SIZE]);
while ( *in ){
- in->getline( line , BUF_SIZE );
+ char * buf = line.get();
+ in->getline( buf , BUF_SIZE );
uassert( 10263 , "unknown error reading file" , ( in->rdstate() & ios_base::badbit ) == 0 );
- log(1) << "got line:" << line << endl;
+ log(1) << "got line:" << buf << endl;
- char * buf = line;
while( isspace( buf[0] ) ) buf++;
int len = strlen( buf );