Hi All,
Just started investigating using V8 in my application.
I have the hello world demo built and running (I have
added V8::Initialize();).
I changed the code getting run from "'Hello' + ', World!'" to "(new
Array(1024*1024)).join('x');" and it now SegFaults.
Running it in ddd shows:
Program received signal SIGSEGV, Segmentation fault.
0x00000000005194db in
v8::internal::MarkCompactCollector::StartSweeperThreads() ()
Stack Trace:
#1 0x0000000000523448 in v8::internal::MarkCompactCollector::SweepSpaces()
()
#2 0x0000000000528399 in
v8::internal::MarkCompactCollector::CollectGarbage() ()
#3 0x00000000004ea2fb in v8::internal::Heap::MarkCompact() ()
#4 0x00000000004f955d in
v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector,
v8::GCCallbackFlags) ()
#5 0x00000000004f9a27 in
v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char
const*, char const*, v8::GCCallbackFlags) ()
#6 0x00000000004f9c6f in v8::internal::Heap::CollectAllGarbage(int, char
const*, v8::GCCallbackFlags) ()
#7 0x000000000049bd15 in v8::internal::StackGuard::HandleInterrupts() ()
#8 0x00000000007c21a4 in v8::internal::Runtime_StackGuard(int,
v8::internal::Object**, v8::internal::Isolate*) ()
#9 0x00001acf3bc0843b in ?? ()
#10 0x00001acf3bc08381 in ?? ()
#11 0x00007fffffffd590 in ?? ()
I have attached 'hello.cpp' which I build using the command:
g++ -Iinclude hello.cpp -o hello -Wl,--start-group
out/native/obj.target/{tools/gyp/libv8_{base,libbase,snapshot},third_party/icu/libicu{uc,i18n,data}}.a
-Wl,--end-group -lrt -lpthread -g
This is from within the root of the v8 directory.
I built the v8 library using 'make native' from the master branch of
https://chromium.googlesource.com/external/v8.git
Environment:
gcc -v: gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
uname -a: Linux XXXX 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Any pointers on what I'm doing wrong would be appreciated.
Thanks,
Mark
--
--
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.
#include <v8.h>
using namespace v8;
int main(int argc, char* argv[]) {
V8::Initialize();
// Create a new Isolate and make it the current one.
Isolate* isolate = Isolate::New();
Isolate::Scope isolate_scope(isolate);
// Create a stack-allocated handle scope.
HandleScope handle_scope(isolate);
// Create a new context.
Local<Context> context = Context::New(isolate);
// Enter the context for compiling and running the hello world script.
Context::Scope context_scope(context);
// Create a string containing the JavaScript source code.
Local<String> source = String::NewFromUtf8(isolate, "(new Array(1024*1024)).join('x');");
// Compile the source code.
Local<Script> script = Script::Compile(source);
printf("calling Script\n");
// Run the script to get the result.
Local<Value> result = script->Run();
printf("called Script\n");
// Convert the result to an UTF8 string and print it.
String::Utf8Value utf8(result);
printf("%d\n", utf8.length());
return 0;
}