Eli*_*zer 2 java singleton android reference classloader
我有一个单身人士,我希望在一生中保持活力Application.
public final class KeepAlive extends Whatever {
private KeepAlive() {}
private static class Singleton {
private static final KeepAlive instance = new KeepAlive();
}
}
Run Code Online (Sandbox Code Playgroud)
被Singleton.instance认为是一个强有力的参考,所以它不会得到GC?
更新: Android是否使用自定义类加载器?是这样的,它会永远卸一类像KeepAlive或Singleton?