Index: samples/shell.cc |
diff --git a/samples/shell.cc b/samples/shell.cc |
index ad9b1aba8bfd8b30be150bccb489f2ee31c4240f..c5f1a73f3188e7f17c433ad5a80dd2d6d64b36bc 100644 |
--- a/samples/shell.cc |
+++ b/samples/shell.cc |
@@ -63,17 +63,6 @@ void ReportException(v8::Isolate* isolate, v8::TryCatch* handler); |
static bool run_shell; |
-class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
- public: |
- virtual void* Allocate(size_t length) { |
- void* data = AllocateUninitialized(length); |
- return data == NULL ? data : memset(data, 0, length); |
- } |
- virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
- virtual void Free(void* data, size_t) { free(data); } |
-}; |
- |
- |
int main(int argc, char* argv[]) { |
v8::V8::InitializeICUDefaultLocation(argv[0]); |
v8::V8::InitializeExternalStartupData(argv[0]); |
@@ -81,9 +70,9 @@ int main(int argc, char* argv[]) { |
v8::V8::InitializePlatform(platform); |
v8::V8::Initialize(); |
v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
- ShellArrayBufferAllocator array_buffer_allocator; |
v8::Isolate::CreateParams create_params; |
- create_params.array_buffer_allocator = &array_buffer_allocator; |
+ create_params.array_buffer_allocator = |
+ v8::ArrayBuffer::Allocator::NewSimpleAllocator(); |
v8::Isolate* isolate = v8::Isolate::New(create_params); |
run_shell = (argc == 1); |
int result; |
@@ -103,6 +92,7 @@ int main(int argc, char* argv[]) { |
v8::V8::Dispose(); |
v8::V8::ShutdownPlatform(); |
delete platform; |
+ delete create_params.array_buffer_allocator; |
return result; |
} |