JEP 132: More-prompt finalization
kirk at kodewerk.com
Fri Jan 6 09:02:14 PST 2012
On 2012-01-06, at 5:16 PM, Tony Printezis wrote:
> On 01/06/2012 08:57 AM, Kirk Pepperdine wrote:
>> Tony, David,
>> I really feel that this problem is being solved at the wrong level. The JVM lacks application semantics to know when to do the "right" thing.
> I absolutely agree.
>> So, IMHO, this should be managed by the application.
> I absolutely disagree. :-)
> First, let's define some terminology to make sure we're all on the same page:
> JVM : HotSpot
> library : the Java code that manages certain native resource (e.g., classes in the java.io package) - I do not consider this part of the JVM
> application : what the user writes which runs on top of HotSpot and uses java.io.File's.
Ok, so with these definitions I'd say that anything but the JVM should manage those things to which it doesn't have semantics knowledge. That would be the application or library (I bundled these together when I shouldn't have).
>> For the same reason, there are other things that the application shouldn't touch like telling the JVM it's time to run a collection.
> Amen to that. :-)
>> That said, one thing the JVM might know about is how many file descriptors it's allowed and it could trigger an attempt to recover them (i.e. run finalization) once they start running low..
> Indeed. But the JVM (as defined above) does not know anything about file descriptors. It's the library, in this case classes in java.io, that does. However, I don't think said library should also be calling System.gc() either. It should be providing information to the GC, via the API I have been suggesting, on how much of a certain resource we have and the GC should be making informed decisions on whether it when it should trigger a cycle.
Ok, again, my confused terminology… basically I don't see how the collector could make an informed decision on anything other than file descriptors. Would it have to track rates of consumption and desposal to build an understanding of when it should take action?
More information about the hotspot-dev