[concurrency-interest] Is Reference.reachabilityFence() needed in Reference constructor?

Vitaly Davidovich vitalyd at gmail.com
Wed Oct 21 18:23:27 EDT 2015


>
> That seems highly problematic for WeakReference and company to be usable.
> How can any object using those APIs guarantee that the object itself is
> strongly reachable?  Doesn’t seem like they can


That's what this thread is about.

On Wed, Oct 21, 2015 at 6:10 PM, Gregg Wonderly <gergg at cox.net> wrote:

>
> On Oct 21, 2015, at 4:44 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote:
>
> But the referent arg is on the stack (since the constructor is)
>> Aren't all variables on the stack strongly reachable?
>
>
> No.  The stacks are scanned and oopmaps are inspected to find live
> objects, which then serve as the root of a reachability graph, but mere
> presence of an object on the stack does not mean it's reachable for GC
> purposes.
>
>
> That seems highly problematic for WeakReference and company to be usable.
> How can any object using those APIs guarantee that the object itself is
> strongly reachable?  Doesn’t seem like they can.  Strong references can
> only ever be guaranteed by using a static reference, which makes for
> non-static environments to be really difficult to “develop” in.
>
> Gregg Wonderly
>
>
> On Wed, Oct 21, 2015 at 4:29 PM, thurstonn <thurston at nomagicsoftware.com>
> wrote:
>
>> But the referent arg is on the stack (since the constructor is)
>> Aren't all variables on the stack strongly reachable?
>>
>>
>>
>> --
>> View this message in context:
>> http://jsr166-concurrency.10961.n7.nabble.com/Is-Reference-reachabilityFence-needed-in-Reference-constructor-tp12819p12824.html
>> Sent from the JSR166 Concurrency mailing list archive at Nabble.com
>> <http://nabble.com>.
>> _______________________________________________
>> Concurrency-interest mailing list
>> Concurrency-interest at cs.oswego.edu
>> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>>
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20151021/36285d60/attachment-0001.html>


More information about the Concurrency-interest mailing list