Hello,
I am trying to implement a simple web server where web pages will be
rendered with V8 and React.js.
I need to load React.js once and make it available in the global space,
and then upon request i need to read different javascript files and render
them with React with passed parameters from the C code...
Can somebody help?
When I try to run the following code it is working only for about 500
iterations and then it is exiting with "Segmentation fault" error..
This means that i can run only 500 queries on the server or even less. If i
reinitialize isolate on every iteration it is working but rendering becomes
very slow.
Is there a way to run infinite iterations with the test.js script without
getting "Segmentation fault"?
v8::V8::Initialize();
m_isolate = v8::Isolate::New();
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope scope(m_isolate);
v8::Handle<v8::Context> context = v8::Context::New(m_isolate);
v8::Context::Scope context_scope(context);
v8::Handle<v8::String> reactSrc = ReadFile(m_isolate, "react.js");
v8::Local<v8::Script> script = v8::Script::Compile(reactSrc);
v8::Handle<v8::Value> result = script->Run();
v8::Handle<v8::String> testSrc = ReadFile(m_isolate, "test.js");
//the number of available iterations before it crash somehow depends on
the size of test.js script
for(int i=0; i<1000; i++){
v8::Local<v8::Script> script = v8::Script::Compile(testSrc);
v8::Handle<v8::Value> result = script->Run();
v8::String::Utf8Value utf8(result);
//printf("%s\n",*utf8);
}
v8::V8::Dispose();
Thank you!
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.