Hi there!

Full disclosure, I'm swimming in the deep end of the pool with 
half-deflated floaties when it comes to C and C++. 

I'm currently working on making v8eval <https://github.com/sony/v8eval> (a 
super simple wrapper for V8) work with version 8.0.426.9 of V8. 

The library seems to work fine when linked with V8 version 7.1.177.

However with version 8.0.426.9 I'm getting a segmentation fault when the 
destructor of the V8 proxy class (Called `_V8`) is called. The destructor 
is calling dispose on the Isolate that is used by the instance of the V8 
wrapper. 

The following is the dump from Valgrind when the fault occurs:


==29952== Memcheck, a memory error detector
==29952== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29952== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==29952== Command: ./testing --leak-check=full --main-stacks=20000000
==29952==
==29952== error calling PR_SET_PTRACER, vgdb might block
==29952== Warning: set address range perms: large range [0x235800000000, 
0x235a00000000) (noaccess)
==29952== Warning: set address range perms: large range [0x235800000000, 
0x235a00000000) (noaccess)
==29952== Warning: set address range perms: large range [0x235800000000, 
0x235900000000) (noaccess)
"2489.824"
==29952== Warning: set address range perms: large range [0x235800000000, 
0x235900000000) (noaccess)
==29952== Invalid read of size 8
==29952==    at 0x1F73C6: v8::Isolate::Dispose() (in 
/home/tom/projects/v8_workspace/testing)
==29952==    by 0x1F011F: v8eval::_V8::~_V8() (testing.cxx:62)
==29952==    by 0x1F2673: main (testing.cxx:225)
==29952==  Address 0x235800009fc0 is not stack'd, malloc'd or (recently) 
free'd
==29952==
==29952==
==29952== Process terminating with default action of signal 11 (SIGSEGV)
==29952==  Access not within mapped region at address 0x235800009FC0
==29952==    at 0x1F73C6: v8::Isolate::Dispose() (in 
/home/tom/projects/v8_workspace/testing)
==29952==    by 0x1F011F: v8eval::_V8::~_V8() (testing.cxx:62)
==29952==    by 0x1F2673: main (testing.cxx:225)
==29952==  If you believe this happened as a result of a stack
==29952==  overflow in your program's main thread (unlikely but
==29952==  possible), you can try to increase the size of the
==29952==  main thread stack using the --main-stacksize= flag.
==29952==  The main thread stack size used in this run was 8388608.
==29952==
==29952== HEAP SUMMARY:
==29952==     in use at exit: 26,998 bytes in 660 blocks
==29952==   total heap usage: 2,288 allocs, 1,628 frees, 759,996 bytes 
allocated
==29952==
==29952== LEAK SUMMARY:
==29952==    definitely lost: 8 bytes in 1 blocks
==29952==    indirectly lost: 0 bytes in 0 blocks
==29952==      possibly lost: 2,432 bytes in 8 blocks
==29952==    still reachable: 24,558 bytes in 651 blocks
==29952==         suppressed: 0 bytes in 0 blocks
==29952== Rerun with --leak-check=full to see details of leaked memory
==29952==
==29952== For counts of detected and suppressed errors, rerun with: -v
==29952== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)


The destructor from the `_V8` class:

_V8::~_V8() {
  isolate_->Dispose();
}



Next is a snippet of the main method of my test project that is 
initializing V8, creating an instance of the V8 wrapper class, executing 
some JavaScript, and disposing...

int main(int argc, char* argv[]) {

  v8eval::initialize();

  v8eval::_V8 v8;

  string result = v8.eval("const profits = 2489.8237; profits.toFixed(3);");

  printf("%s\n", result.c_str());

  v8.~_V8();

  v8eval::dispose();

  return 0;
}


If it helps the following is a link to a gist that I created that contains 
the full source of my test program as well as the "v8eval.h" header that is 
referenced by that program.  

The research that I've done on this issue thus far on the error "Access not 
within mapped region at address" hasn't yielded anything. 

What should my next steps be here?

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/b3430b45-ecef-422a-aea1-f812e7bfe136%40googlegroups.com.

Reply via email to