Repository navigation
Allow to disable deleting of the native library file after it is loaded. - #6118
normanmaurer wants to merge 1 commit into
Conversation
Motivation: When profiling it is sometimes needed to still have the native library file avaible. We should allow to disable the explicit deletion and just delete it when the JVM stops. This is related to #6110 Modifications: Add io.netty.native.deleteLibAfterLoading system property which allows to disable the explicit delete after laoding Result: Possible to profile native libraries better.
|
@tjake I think this is what you need, can you verify ? @Scottmitch PTAL |
|
+1 |
| } | ||
|
|
||
| DELETE_NATIVE_LIB_AFTER_LOADING = SystemPropertyUtil.getBoolean( | ||
| "io.netty.native.deleteLibAfterLoading", true); |
There was a problem hiding this comment.
should this be scoped to a particular library? Just wondering if we ever load multiple libraries using this loader if we want to have a global flag or scope it per load.
There was a problem hiding this comment.
I think it should be global
There was a problem hiding this comment.
couldn't we build the global flag at a higher level if the low level library loader allows individual libraries to be configured?
There was a problem hiding this comment.
What you mean? I am not sure I understand what you are suggesting
There was a problem hiding this comment.
// NativeLibraryLoader.java
// Users can call this method if they want to respect the default.
// This also allows users to apply their own logic ...
// e.g. maybe EPOLL, KQUEUE, TCNATIVE have their own properties at some point.
public static boolean defaultDeleteAfterLoading() {
return DELETE_NATIVE_LIB_AFTER_LOADING;
}
public static void loadFirstAvailable(boolean deleteAfterLoading, ClassLoader loader, String... names) {
// load(deleteAfterLoading, loader, name);
}
public static void load(boolean deleteAfterLoading, String name, ClassLoader loader) {
}There was a problem hiding this comment.
@Scottmitch I can do this but I think either you want it for all or for none. So I think it is overkill and makes not a lot of sense in a practical sense. So please tell me if you feel super strong about it and if so I will do, but honestly I think it makes more sense as it is.
There was a problem hiding this comment.
No, I'm not strong on this. Feel free to pull in.
I would generally prefer to express configuration in terms of API as opposed to introduce another vector (system properties) which impacts the API. This is a more general concern in Netty though IMO there is room for improvement in configuration/setup.
Motivation:
When profiling it is sometimes needed to still have the native library file avaible. We should allow to disable the explicit deletion and just delete it when the JVM stops.
This is related to #6110
Modifications:
Add io.netty.native.deleteLibAfterLoading system property which allows to disable the explicit delete after laoding
Result:
Possible to profile native libraries better.