Skip to content
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

Delete of native lib doesn't work on Windows #132

Closed
broneill opened this issue Dec 2, 2018 · 2 comments
Closed

Delete of native lib doesn't work on Windows #132

broneill opened this issue Dec 2, 2018 · 2 comments

Comments

@broneill
Copy link

broneill commented Dec 2, 2018

This is a duplicate of issue #102, which was closed without actually being fixed. When loading a native library on Windows, the file is locked and cannot be deleted. Attempting to use the "delete on exit" feature doesn't actually work, because the delete attempt occurs before the native library is unloaded.

@odaira
Copy link
Member

odaira commented Dec 3, 2018

As far as I searched the Web, there is no reliable way to delete a temporary native library at exit on Windows.
https://stackoverflow.com/questions/33226381/cannot-delete-a-temporary-file-when-it-is-used-to-load-a-system-library
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=5086661
The only seemingly possible solution would be to call Runtime.runFinalizersOnExit(true);, but this method is deprecated, and I am not sure a library like lz4-java should call this kind of method that might affect the whole program.

However, I found this approach in sqlite-jdbc might help solve the problem. I will investigate it more.

@odaira
Copy link
Member

odaira commented Sep 24, 2019

Fixed by 08b3bff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants