rusty_v8 icon indicating copy to clipboard operation
rusty_v8 copied to clipboard

v8 may cause dynamic link libraries to not be released even after FreeLibrary

Open lazytiger opened this issue 1 year ago • 4 comments
trafficstars

I have to use v8 as DLL in Windows. However, when I did a FreeLibrary, I found that my process still holds the library. I tried to drop Isolate and global context before calling FreeLibrary, but it did no good. What's the recommended way to gracefully shutdown the engine then? Thanks.

lazytiger avatar Aug 26 '24 09:08 lazytiger

unloading dynamic libraries is generally not supported. you can simply exit the process after deinitializing V8.

devsnek avatar Aug 26 '24 19:08 devsnek

Is this a limitation in the v8 engine or just rusty_v8?

lazytiger avatar Aug 26 '24 22:08 lazytiger

this is a limitation of most dynamic libraries in general. you need to build them with special linker flags and ensure everything has proper destructors and etc. and its not done very often because there is not usually any reason to unload them. are you hitting a specific issue requiring you to unload v8?

devsnek avatar Aug 26 '24 22:08 devsnek

Yes, I am using it in the Unity editor. Whenever I make some modifications in v8, I must restart the Unity editor. If this is not supported, I have a workaround to just copy the DLL, and Load the copied one to make sure the original one can be updated every time.

lazytiger avatar Aug 26 '24 23:08 lazytiger