Access violation using V8
Closed this issue · 1 comments
pauldotknopf commented
I am trying to use this library to embed node inside of my process.
I am using @a507a3c (electron v0.36.9)
Windows 10, VS 2013, x86, Debug build.
I was having trouble with even a simple node::Start
, so I traced it down to V8 throwing an exception.
#include "stdafx.h"
#include "node.h"
#include "include/v8.h"
#include <cstdlib>
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); }
};
extern "C"
{
__declspec(dllexport) void __stdcall start_node()
{
v8::V8::Initialize();
ArrayBufferAllocator allocator;
v8::Isolate::CreateParams params;
params.array_buffer_allocator = &allocator;
v8::Isolate::New(params); // ACCESS VIOLATION HERE!
}
}
The exact error message is:
Exception thrown at 0x04EDF885 (v8.dll) in Test.exe: 0xC0000005: Access violation reading location 0x00000008.
Any ideas why this would fail? When compiling electron in debug model, I still can't step into the v8.dll to trace the issue further.
codebytere commented
Closing since node and electron have both been updated significantly since this was filed; feel free to @ me in a follow up if this persists