RFR 9: 8165641 : Deprecate Object.finalize
aph at redhat.com
Tue Mar 14 18:03:41 UTC 2017
On 14/03/17 14:01, Timo Kinnunen wrote:
> File handles aren’t that scarce of a resource, really, at least on
I've seen processes running out of file handles. It is possible to
change the per-process limit. And, of course, there is a lot of
hidden context in the kernel and device drivers.
> On Windows threads are a lot scarcer resource than file handles, and
> I don’t recall anyone suggesting Java’s GC wasn’t suitable for
> managing that limited but crucially important resource.
Java's GC isn't used for managing threads.
> The question should then be, what makes threads so much easier to
> manage than file handles and how can we make file handles be more
> like threads?
> Food for thought: threads need a big stack which means a lot of
> memory, but a file handle might be just 8 bytes which is hard to
> keep track of. So, change the storage of file handles to use slot-0
> of new long;
I did try that, and it does work, but it's an ugly waste of memory.
More information about the core-libs-dev