-
Notifications
You must be signed in to change notification settings - Fork 185
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
atexit() is probably not a good way to clean up Lua VM #712
Comments
You beat me to finally writing up an issue to report this. I have encountered this same issue when using luv with musl libc, because unlike glibc musl does not handle shared libraries specially with regards to atexit hooks. I'd even go farther to assert that using This problem doesn't manifest in most scenarios because Windows and glibc (likely also apple, but cannot verify) handle atexit calls in a shared library to be registered instead right before the shared library is unloaded. A likely more correct implementation would use |
nod, it doesn't make sense on the main thread or static link program. only scenario of available is when the user triggers gc normally in work thread.
|
Hi everyone
I working in Lazarus(freepascal) with luajit & luv, When i try to staitc link luajit and luv in my program, I got some trouble.
luv work well in dll mode on windows/mingw, because atexit() works on dll instance, The main thread's memory will not be written.
but if i build luv as a static lib and preload it in Lua/LuaJIT static lib, and link them to freepascal. when i require luv then get a runtime error, cause the halt() mechanism of freepascal compiler is incompatible with atexit().
I think other languages that can statically link c libs may have this problem.
I thought we may need explicit call a method such as uv.clearVM() before terminate threads that required luv?
The text was updated successfully, but these errors were encountered: