summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-12-27 11:58:03 -0500
committerEliot Horowitz <eliot@10gen.com>2010-12-27 11:58:03 -0500
commit57be437dd82e21844d0ed5248a4b6f8f9ac5b61e (patch)
tree86e456dc29c7b5d25fd3aafd739b19d213608d26 /scripting
parentc0bc8d6d66d0f5f174b2bae8def422967841910a (diff)
downloadmongo-57be437dd82e21844d0ed5248a4b6f8f9ac5b61e.tar.gz
better js error message on out of memory SERVER-2280
Diffstat (limited to 'scripting')
-rw-r--r--scripting/engine_spidermonkey.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp
index 5bc2a5c120b..bb2be367775 100644
--- a/scripting/engine_spidermonkey.cpp
+++ b/scripting/engine_spidermonkey.cpp
@@ -36,6 +36,9 @@
massert(13072,(string)"JS_NewObject failed: " + w ,xx); \
}
+#define CHECKJSALLOC( newthing ) \
+ massert( 13615 , "JS allocation failed, either memory leak or using too much memory" , newthing )
+
namespace mongo {
class InvalidUTF8Exception : public UserException {
@@ -521,7 +524,7 @@ namespace mongo {
throw InvalidUTF8Exception();
}
- assert( s );
+ CHECKJSALLOC( s );
return STRING_TO_JSVAL( s );
}
@@ -592,7 +595,7 @@ namespace mongo {
int n = embed.nFields();
JSObject * array = JS_NewArrayObject( _context , n , 0 );
- assert( array );
+ CHECKJSALLOC( array );
jsval myarray = OBJECT_TO_JSVAL( array );