diff --git a/shell/MongoJS.cpp b/shell/MongoJS.cpp index d6d0b76dedc..cb1fbebcf16 100644 --- a/shell/MongoJS.cpp +++ b/shell/MongoJS.cpp @@ -75,6 +75,7 @@ Handle mongoInit(const Arguments& args){ return v8::ThrowException( v8::String::New( "couldn't connect" ) ); } + // NOTE I don't believe the conn object will ever be freed. args.This()->Set( CONN_STRING , External::New( conn ) ); args.This()->Set( String::New( "slaveOk" ) , Boolean::New( false ) ); @@ -336,6 +337,7 @@ Handle mongoFind(const Arguments& args){ v8::Function * cons = (v8::Function*)( *( mongo->Get( String::New( "internalCursor" ) ) ) ); Local c = cons->NewInstance(); + // NOTE I don't believe the cursor object will ever be freed. c->Set( v8::String::New( "cursor" ) , External::New( cursor.release() ) ); return c; } diff --git a/shell/ShellUtils.cpp b/shell/ShellUtils.cpp index 4403b09bca8..51fd650e9a1 100644 --- a/shell/ShellUtils.cpp +++ b/shell/ShellUtils.cpp @@ -233,7 +233,7 @@ extern v8::Handle< v8::Context > baseContext_; class JSThreadConfig { public: JSThreadConfig( const Arguments &args ) : started_(), done_() { - jsassert( args.Length() > 0, "need to sxpecify at least one argument to fork" ); + jsassert( args.Length() > 0, "need at least one argument" ); jsassert( args[ 0 ]->IsFunction(), "first argument must be a function" ); Local< Function > f = Function::Cast( *args[ 0 ] ); f_ = Persistent< Function >::New( f ); @@ -241,7 +241,6 @@ public: args_.push_back( Persistent< Value >::New( args[ i ] ) ); } ~JSThreadConfig() { - cout << "goodbye" << endl; f_.Dispose(); for( vector< Persistent< Value > >::iterator i = args_.begin(); i != args_.end(); ++i ) i->Dispose(); @@ -294,7 +293,9 @@ private: Handle< Value > ThreadInit( const Arguments &args ) { Handle it = args.This(); - // NOTE I believe the passed JSThreadConfig will never be freed. + // NOTE I believe the passed JSThreadConfig will never be freed. If this + // policy is changed, JSThread may no longer be able to store JSThreadConfig + // by reference. it->Set( String::New( "_JSThreadConfig" ), External::New( new JSThreadConfig( args ) ) ); return Undefined(); }