Patch: FYI: gcj3.1 status update
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Fri Apr 5 20:20:00 GMT 2002
Andrew Haley wrote:
>Better though to fix System.gc() so that it doesn't return until a
>grabage collection cycle has really happned. There are deadlock
>problems with this, as I mentioned before. I guess we could work
>around that problem with a fairly short timeout.
>
I don't think there is any deadlock danger with System.gc(), only
runFinalization(). So, a solution might be to use the java.util.ref
stuff to keep track of what FileDescriptor objects are reachable. If we
run out of descriptors in open, it should call System.gc() (which can
wait until a full collection has been completed, but not run finalizers)
and then close the unreachable ones if we run out.
I do agree with Jeff that this is probibly not really that bad, however.
Well written code that is opening a lot of files/sockets ought to call
close() explicitly.
regards
Bryce.
More information about the Java
mailing list