Does that old version already have a file include/v8-platform.h? In that
case, you need either implement that interface and register it with V8
before creating the first isolate, or link against the libplatform library
and use the implementation from that one.

On Wed, Jan 6, 2016 at 12:42 PM Danny Dorfman <[email protected]>
wrote:

> Hello there,
>
> I am running V8 3.31.1, and I am experiencing an issue that looks like GC
> exhaustion. The code I run is as follows:
>
> #include <v8.h>
> #include <iostream>
>
>
> v8::Handle<v8::String> Stringify(v8::Isolate *isolate, v8::Handle<v8::
> Value> val)
> {
>     v8::EscapableHandleScope handle_scope(isolate);
>     if (!val.IsEmpty() && val->IsString())
>     {
>         v8::Local<v8::String> ret = v8::Handle<v8::String>::Cast(val);
>         return handle_scope.Escape(ret);
>     }
>     v8::String::Utf8Value charVal(val);
>     v8::Local<v8::String> ret = v8::String::NewFromUtf8(isolate, *charVal
> );
>     return handle_scope.Escape(ret);
> }
>
>
> void CreateValue(v8::Isolate *isolate, int32_t number)
> {
>     if ((number % 10000) == 0) std::cout << "number = " << number << std::
> endl;
>     v8::HandleScope handle_scope(isolate);
>     v8::Local<v8::Value> iVal = v8::Integer::New(isolate,number);
>     v8::Local<v8::String> sVal = Stringify(isolate,iVal);
>     (void)sVal;
> }
>
>
> int main(int argc, char* argv[])
> {
>   v8::V8::Initialize();
>   v8::Isolate* isolate = v8::Isolate::New();
>   v8::Isolate::Scope isolate_scope(isolate);
>   v8::HandleScope handle_scope(isolate);
>   v8::Local<v8::Context> context = v8::Context::New(isolate);
>   v8::Context::Scope context_scope(context);
>   for (int32_t i = 0; i < 0x7FFFFFFF; ++i)
>   {
>     CreateValue(isolate,i);
>   }
>   return 0;
> }
>
>
>
> When I execute it, it crashes:
>
> # gdb stringify
> GNU gdb (GDB) 7.6
> Copyright (C) 2013 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from /root/v8/samples/hello_stringify...(no debugging
> symbols found)...done.
> (gdb) run
> Starting program: /root/v8/samples/hello_stringify
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> [New Thread 0x7ffff4613700 (LWP 23709)]
> number = 0
> number = 10000
> number = 20000
> number = 30000
> number = 40000
> number = 50000
> number = 60000
> number = 70000
> number = 80000
> number = 90000
> number = 100000
> number = 110000
> number = 120000
> number = 130000
> number = 140000
> number = 150000
> number = 160000
> number = 170000
> number = 180000
> number = 190000
> number = 200000
> number = 210000
> number = 220000
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff76a8071 in
> v8::internal::MarkCompactCollector::StartSweeperThreads() () from
> /usr/lib64/libv8.so
> (gdb) bt
> #0  0x00007ffff76a8071 in
> v8::internal::MarkCompactCollector::StartSweeperThreads() () from
> /usr/lib64/libv8.so
> #1  0x00007ffff76b2378 in
> v8::internal::MarkCompactCollector::SweepSpaces() () from
> /usr/lib64/libv8.so
> #2  0x00007ffff76bd11c in
> v8::internal::MarkCompactCollector::CollectGarbage() () from
> /usr/lib64/libv8.so
> #3  0x00007ffff767cb56 in v8::internal::Heap::MarkCompact() () from
> /usr/lib64/libv8.so
> #4  0x00007ffff7685b65 in
> v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector,
> v8::GCCallbackFlags) () from /usr/lib64/libv8.so
> #5  0x00007ffff7685f7a in
> v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char
> const*, char const*, v8::GCCallbackFlags) () from /usr/lib64/libv8.so
> #6  0x00007ffff7637fce in v8::internal::Factory::NewRawOneByteString(int,
> v8::internal::PretenureFlag) () from /usr/lib64/libv8.so
> #7  0x00007ffff76380f9 in
> v8::internal::Factory::NewStringFromOneByte(v8::internal::Vector<unsigned
> char const>, v8::internal::PretenureFlag) () from /usr/lib64/libv8.so
> #8  0x00007ffff763848e in
> v8::internal::Factory::NewStringFromUtf8(v8::internal::Vector<char const>,
> v8::internal::PretenureFlag) () from /usr/lib64/libv8.so
> #9  0x00007ffff7508b7c in v8::String::NewFromUtf8(v8::Isolate*, char
> const*, v8::String::NewStringType, int) () from /usr/lib64/libv8.so
> #10 0x00000000004013db in Stringify(v8::Isolate*, v8::Handle<v8::Value>) ()
> #11 0x000000000040148a in CreateValue(v8::Isolate*, int) ()
> #12 0x000000000040121d in main ()
>
> Any reason why this should be happening? Am I doing anything wrong?
>
> Regards,
> Danny
>
> --
> --
> 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.
>

-- 
-- 
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.

Reply via email to