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

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Oct 21 18:04:40 EDT 2015


No, they aren't. That's a common misconception.

https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6.1:

"Optimizing transformations of a program can be designed that reduce the
number of objects that are reachable to be less than those which would
naively be considered reachable. For example, a Java compiler or code
generator may choose to set a variable or parameter that will no longer
be used to null to cause the storage for such an object to be
potentially reclaimable sooner."


Thanks,
-Aleksey

On 10/21/2015 11:29 PM, thurstonn 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.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20151022/e565e2ac/attachment.bin>


More information about the Concurrency-interest mailing list