Re: Finalizers & Reference counting.
Andrew Shi-hwa Chen <[email protected]>
| Newsgroups | gmane.comp.programming.garbage-collection.general |
|---|---|
| Message-ID | <[email protected]> |
I think "don't promote" is overly specific. Here's my suggestion for something more genera: Class c = object.getClass; thisThead.pushLifetimeEstimate(c,someValue); ... // do some work with the objects ... thisThread.popLifetimeEstimate(c); This tells the collector what it needs to know irrespective of implementation (irrespective of generation size, whether it's a generational collector at all, etc...), doesn't have threading issues, and if used properly doesn't have to worry about called functions setting the lifetime estimate incorrectly. Of course, it'd be nice if the mutator could give some kind of guarrantee that no more than X percent of the lifetime estimates would be incorrect, so we'd be able to have a running bound on the actual amount of space we need in "to-space" other than the worst-case assumption that everything might be live (which is what seems to always be done).... -- Andrew Chen [email protected] Nick Barnes wrote: > At 2002-08-30 23:10:42+0000, David Chase writes: > > GCTime gct = gc.getTimeStamp(); > > ... > > // Insert compiler phase here. > > ... > > gc.collectYoungerThan(gct); > > > > A more precise interface would be > > > > gc.collectBetween(gct_begin, gct_end); > > > > Of course, an implementation is free to take these as a mere hint, > > and either not collect, or collect everything. > > This sort of thing is good. Some sort of "don't promote" interface is > also useful. > > Nick B