This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: finalize interned strings


Tom Tromey wrote:

> >> I'm now wondering: Does the collector guarentee that finalizers
> >> will be run immediatly when an object is collected? Or can the
> >> running of finializers be deferred until a later collection in some
> >> cases?
>
> Jeff> Finalizers should run *before* an object is collected.
>
> Yeah.  I interpreted Bryce's question as "will the finalizer be run
> immediately when the object is unreachable?".  And the answer is "not
> necessarily".

Right, but as long as the finalizer is run at some stage *before* the
object gets collected, there shouldn't be a problem, so I think what
we're trying to do with the finalizer is correct. The pointers in the
hashtable are already basically weak references, as the hashtable is
allocated as pointer-free memory so it shouldn't be scanned during
marking.

I think I may have found the problem though (and now I understand what
DELETED_STRING is trying to do): if you have two strings that hash to the
same value, _Jv_StringFindSlot will return the wrong index in the case
that the first string with the same hash value has already been
finalized. Hmm...

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]