Index: samples/hello-world.cc |
diff --git a/samples/hello-world.cc b/samples/hello-world.cc |
index 902d8d55461c673090c8661c125fcee34a2ba1e3..9e5188f4792ca8e16875f70b334d5f1addbaa1c5 100644 |
--- a/samples/hello-world.cc |
+++ b/samples/hello-world.cc |
@@ -11,17 +11,6 @@ |
using namespace v8; |
-class ArrayBufferAllocator : 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[]) { |
// Initialize V8. |
V8::InitializeICUDefaultLocation(argv[0]); |
@@ -31,9 +20,9 @@ int main(int argc, char* argv[]) { |
V8::Initialize(); |
// Create a new Isolate and make it the current one. |
- ArrayBufferAllocator allocator; |
Isolate::CreateParams create_params; |
- create_params.array_buffer_allocator = &allocator; |
+ create_params.array_buffer_allocator = |
+ v8::ArrayBuffer::Allocator::NewDefaultAllocator(); |
Isolate* isolate = Isolate::New(create_params); |
{ |
Isolate::Scope isolate_scope(isolate); |
@@ -68,5 +57,6 @@ int main(int argc, char* argv[]) { |
V8::Dispose(); |
V8::ShutdownPlatform(); |
delete platform; |
+ delete create_params.array_buffer_allocator; |
return 0; |
} |