Comment #5 on issue 3523 by [email protected]: Deadlock after calling IdleNotification(100) or Dispose on isolate
https://code.google.com/p/v8/issues/detail?id=3523

As Jakob already mentioned, relying on any form of finalization is a bad idea, nevertheless, this idea comes up regularly. ;-) The only safe and sane way to do this in general is as follows:

* When you create some C++ object which is somehow tied to a JavaScript object, register that object on the C++ side.

* After you've shut down v8 (or only the Isolate in question), deallocate all C++ objects still registered. This has to be done on the embedder side.

* The weak callback is *only* there to deallocate a C++ object earlier, i.e. unregistering it on the C++ side and deleting it.

This way you don't need any funny notifications or GC triggers. For the embedder, calling IdleNotification means "Hey, v8, I don't mind any hiccups/delays right now, do something not too costly if you need to.", while calling LowMemoryNotification means "Oh, sh...! I've got almost no memory left, so hey, v8, by all means: Try to release some memory, even if it takes ages, otherwise we'll crash anyway...". None of those calls guarantee anything about weak callbacks.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to