Hi all,
as part of the refactor of v8::Persistent, I've added the ability to store
and fetch a handle which will live for the lifetime of the Isolate, but
which has none of the complexity and overhead (and problems) of a
Persistent. This can be useful for things like ObjectTemplates and
FunctionTemplates which you might lazily initialize, but need forever once
they have been initialized. There are probably other use cases out there
as well.
The API is simple:
int eternal_index = v8::kUninitializedEternalIndex; // always initialize to
this value
{
HandleScope scope(isolate);
Local<Object> local = .... // some v8 code
eternal_index = local.Eternalize(isolate);
}
// Note: don't actually need a HandleScope to simply get an eternal
Local<Object> local = Local<Object>::GetEternal(isolate, eternal_index);
Any place where you can Eternalize a handle, it's probably best to do so,
as Persistents that live forever can potentially hold on to a lot of memory
in internal data structures.
Cheers,
Dan
--
--
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/groups/opt_out.