almson-refcount icon indicating copy to clipboard operation
almson-refcount copied to clipboard

Open question: What should be the default leak detection level?

Open almson opened this issue 7 years ago • 0 comments

I, and the Java community in general, espouse safety over performance, so I think FULL should be the default. The ResourceReference implementation is very efficient and if objects are closed then finalization is cancelled. Compare this to JDK classes like FileInputStream which use built-in, non-cancellable finalization which creates much more overhead. Compare this even to Netty which puts every created WeakReference into a ConcurrentHashMap.

On the other hand, FileInputStreams only exist once in a chain of wrapping resource-owning classes. There is only one finalize. However, a chain of wrapping ReferenceCountedObjects will each create a ResourceReference.

almson avatar Oct 21 '18 18:10 almson