status of gcj's boehm collector?

Boehm, Hans hans_boehm@hp.com
Thu Dec 6 13:52:00 GMT 2001


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.
In most cases running the loop a maximum of N times, for some small N, is
probably good enough.
Hans
> -----Original Message-----
> From: Andrew Haley [mailto:aph@cambridge.redhat.com]
> Sent: Thursday, December 06, 2001 10:49 AM
> To: Boehm, Hans
> Cc: 'Adam Megacz'; java@gcc.gnu.org
> Subject: RE: status of gcj's boehm collector?
>>> Boehm, Hans writes:
> > 
> > Thinking about this some more, I think the current System.gc() call
> > actually makes a little bit of sense if you run out of some
> > non-memory resource, and want to run both the collector and
> > finalizers.
>> Like file descriptors, f'rexample.
>> 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.
>> Andrew.
>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /