2

How to correctly use Context::Scope ? Do i allocate it while within a method/function scope while actually executing something or can i have a global copy of it next to the Context object ? The documentation isn't very clear on that. I want to make a global Application class and keep all the persistent stuff there not sure if i can put context scope there.

1 Answers1

0

Context::Scope has to be allocated on the call stack outside of your call chain. What you want to do is use a Persistent<Context> to store your Context object globally, and then create a Context::Scope when you enter a JavaScript call stack. This is the case for all of V8's scope objects (HandleScope, Isolate::Scope, etc.).

fluffy
  • 5,212
  • 2
  • 37
  • 67