Hi,

We've been working on migration of existing wrapper classes in Node.js to 
use cppgc::GargageCollected, and ran into some questions regarding what can 
be done in the destructors. The conditions of the destructors don't seem to 
be very clear from the headers, so asking here for some clarification.

1. Is the destructor of cppgc::GargageCollected always called in the thread 
where they are created? It also seems possible for them to be called from 
platform worker threads? In the case where there's no guarantee about this, 
is the recommendation to use prefinalizers to make sure clean up is 
performed on the creation thread?
2. Is it okay to dereference v8::TracedReference held by a 
cppgc::GargageCollected in its destructor? Are they guaranteed to be still 
valid at that point?
3. It seems trying to mutate the heap from a cppgc::GargageCollected 
destructor (e.g. set internal pointers of an object, so I'd assume calling 
into JS or allocating objects would be even more forbidden) would result in 
a crash. Is that something that should not be done, or is there way to do 
it properly? Is it safe to do these from prefinalizers instead?

Appreciate any answers we can get, thanks!

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/v8-dev/6d227630-9fa0-45d3-a84c-cc9b15b4e26cn%40googlegroups.com.

Reply via email to