Copy data into v8::ArrayBuffer
问题 I'm writing a Javascript interpreter in C++ using v8. I need to pass a char buffer into an ArrayBuffer so that it gets garbage collected. Here is my code: QByteArray data_buffer(file.readAll().data(), file.size()); v8::Handle<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(args.GetIsolate(), data_buffer.size()); //insert code to copy data from data_buffer to ab args.GetReturnValue().Set(ab); If I use the constructor from the documentation in which I pass a pointer to the data, I'll have to deal