Index: samples/hello-world.cc |
diff --git a/samples/hello-world.cc b/samples/hello-world.cc |
index 3b952d816b9b966a4f4e003c72dd1396883858d8..2b5340384a76880aa539ba6779403b14f39f5bd6 100644 |
--- a/samples/hello-world.cc |
+++ b/samples/hello-world.cc |
@@ -21,6 +21,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
virtual void Free(void* data, size_t) { free(data); } |
}; |
+void FatalError(const char* loc, const char* msg) { |
+ fprintf(stderr, "fatal error: %s: %s\n", loc, msg); |
+} |
+ |
int main(int argc, char* argv[]) { |
// Initialize V8. |
@@ -35,6 +39,7 @@ int main(int argc, char* argv[]) { |
Isolate::CreateParams create_params; |
create_params.array_buffer_allocator = &allocator; |
Isolate* isolate = Isolate::New(create_params); |
+ isolate->SetFatalErrorHandler(&FatalError); |
{ |
Isolate::Scope isolate_scope(isolate); |
@@ -49,8 +54,11 @@ int main(int argc, char* argv[]) { |
// Create a string containing the JavaScript source code. |
Local<String> source = |
- String::NewFromUtf8(isolate, "'Hello' + ', World!'", |
- NewStringType::kNormal).ToLocalChecked(); |
+ String::NewFromUtf8(isolate, |
+ "var a = []; for (var x = 0; ; x++) { a.push(new " |
+ "Array(104857600)); }", |
+ NewStringType::kNormal) |
+ .ToLocalChecked(); |
// Compile the source code. |
Local<Script> script = Script::Compile(context, source).ToLocalChecked(); |