-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unloading library - V8 #45
Comments
The Javet implementation is compatible with unloading the library, but I decided not to expose that capability. PerformanceLoading the library has to be single threaded which requires singleton pattern to be in place. That is how Javet loads Node.js instance. However, that comes with a noticeable performance overhead because Javet has to a) deploy 10-30MB binary to temp directory; b) load that 10-30MB binary to JVM; 3) initialize the instance. To get rid of that overhead, Javet loads the V8 instance in the default classloader which also forbids the library to be unloaded. SuggestionYou may load Javet in a new classloader. Once that classloader becomes orphan, JVM will unload Javet. |
I actually am already loading javet onto a separate classloader. I tried removing all references and trying to force gc, it seems to not be able to release the classloader altho there are no references to anything loaded by it or the classloader itself held in the application. |
Node.js is not designed to be reloaded. I'm trying to hack it. V8 seems to be compatible with that. I'm testing it. Please stay tuned. It may come true in the next release. In the meanwhile, if you could post you PoC code, that would be very helpful. |
Alright. Thats great. Ill send you the PoC in the morning. |
Good news. That feature is included in this commit. Please wait for the next release. By the way, could you check this discussion out? |
Oh, that's awesome! Is there any ETA for the next release? Also, yea sure, Ill check out that discussion. |
I plan to release it next week. |
Would a earlier patch release be possible? A week might really push our timeline |
Next Monday is public holiday, how about next Tuesday? One of the reasons is: I found a serious bug which might crush JVM. I'm still fixing it. |
Oh I see. Alrighty. Thank you. |
Thank you! |
Description:
We are using the library in an "extension" application which could possibly be reloaded when the user wants.
But this seems to cause issues since the native library remains loaded on the old classloader.
Is there possibly any concise way provided to properly stop or unload the library?
I have tried to remove all references to the classloader that loads javet and classes loaded by that classloader, but it seems calling gc and runFinalization still doesnt unload the library/classloader.
The text was updated successfully, but these errors were encountered: