status of gcj's boehm collector?
Andrew Haley
aph@cambridge.redhat.com
Fri Dec 7 01:46:00 GMT 2001
> > We depend on system.gc closing unused file descriptors. I suspect
> > we'd run out of those long before running out of memory in some
> > applications.
> >
Boehm, Hans writes:
> Interesting. Unfortunately, I think the standard Java interface isn't quite
> sufficient to do that right. I think the logic to do this properly is:
>
> if (I'm out of file descriptors and need one, but not before) {
> for (;;) {
> System.gc();
> System.runFinalization();
> if (the preceding call ran no finalizers || file descriptor is
> available) break;
> }
> }
>
> The loop is needed because running finalizers may result in
> dropping more objects. If finalization dependencies are correctly
> enforced (in Java the client code needs to do that), that's even
> reasonably likely. I think this mean you really need
> runFinalization to return an indication of whether or not it did
> anything so that you can avoid a potentially infinite loop here.
What I'm wondering is whether this is a real or a theoretical
requirement for gcj. So, for our current implementation, is there any
chance that calling System.gc() might not call finalizers for files
that are garmabge before returing?
Andrew.
More information about the Java
mailing list