2016-04-08 1 views
0

は許可されていますか?私がこれをするとどうなりますか? このハンドルはGCによって追跡されないか、GCによって追跡されますが解放されませんか? v8.hでV8でHandleScopeを使用しないでローカルの<Value>を新規作成するとどうなりますか?

/** 
* A stack-allocated class that governs a number of local handles. 
* After a handle scope has been created, all local handles will be 
* allocated within that handle scope until either the handle scope is 
* deleted or another handle scope is created. If there is already a 
* handle scope and a new one is created, all allocations will take 
* place in the new handle scope until it is deleted. After that, 
* new handles will again be allocated in the original handle scope. 
* 
* After the handle scope of a local handle has been deleted the 
* garbage collector will no longer track the object stored in the 
* handle and may deallocate it. The behavior of accessing a handle 
* for which the handle scope has been deleted is undefined. 
*/ 
class V8_EXPORT HandleScope { 

答えて

0

V8が吹くまで。あなたがデバッグビルドを実行している場合、より良いエラーメッセージが表示されますが、クラッシュします。

「check_api_usage」などのようなものです。

私はそのメッセージを何回も見ました。

レキシカルスコープよりも長いJavaScript値を保持する必要がある場合は、代わりにそれを(より高価な)v8::Global<T>オブジェクトに配置する必要があります。 globalはmove-onlyであり、unique_ptrに似ています。

関連する問題