Ephemerons for Java

Jochen Theodorou blackdrag at gmx.org
Tue Jan 10 03:07:05 UTC 2017


On 10.01.2017 03:49, John Rose wrote:
> On Jan 9, 2017, at 5:27 PM, John Rose <john.r.rose at oracle.com
> <mailto:john.r.rose at oracle.com>> wrote:
>
>> Thanks!  That's a great start.  Should be a JEP.  — John
>
> P.S.  You got me.  I filed
> https://bugs.openjdk.java.net/browse/JDK-8172476 to help track this.

I have the feeling the behaviour of the value with regards to GC is 
still a bit underspecified, but if I understand this right, then we do 
as if there is a kind of virtual strong reference from key to value.

I wonder if that kind of logic will get me where I want to. To cite 
myself: "What I would like to have is a new Reference variant that 
allows me to keep an instance alive for as long as the class of the 
object is alive, without the instance keeping the class alive"

That means the key would be the class and the value would be an instance 
of that class.... But doesn´t mean I won´t be getting what I want? 
Wouldn´t the value imply to keep the key alive? Using a WeakReference 
for the value will not get me the logic I want either.

Or maybe let us look at a special case in which the value strongly 
references the key. Will that keep the key and value alive?

bye Jochen



More information about the mlvm-dev mailing list