Review Request: Add ClassOption.STRONG and default is unspecified

John Rose john.r.rose at
Fri Mar 13 00:43:42 UTC 2020

After “doing the math” (in the previous note) I’m with David
being skeptical of “unspecified”.  If a JVM implementation
maps “unspecified” to STRONG that’s a bug, not a feature,
because it takes away the ability to unload the HC based
on GC liveness.  That leads to OOMEs with very difficult
workarounds.  Only WEAK mode is safe.  So the best we
could do is say that “if neither option is specified, then
the mode defaults to WEAK”.  But at that point, why
have WEAK at all? You only need the token for the
non-default setting.

On Mar 11, 2020, at 7:26 PM, David Holmes <david.holmes at> wrote:
>> There are cases that the library code does not care.
> I am skeptical of that. If you do the analysis and determine that you don't need a strong connection then actually getting a strong connection will work fine but may lead to footprint issues. If you don't need a strong connection I don't see why you would choose to let it default rather than selecting weak. If you select weak and find there is a performance issue then you would switch to strong, comment why, and file a RFE to fix the performance issue. I just don't see "don't care" coming into this. And of course if you need strong then allowing it to default is just broken!
>> Note that the main motivation to allow a hidden class be strongly referenced because of our current implementation.   It creates a ClassLoaderData per weak class that may result in fragmentation and incur bad performance overhead.
> That sounds like a deficiency in the VM that should be addressed.
>> This is solely implementation detail.  Other VM implementation may favor weak classes.  An implementation-specific default will give flexibility to the developers (not to specify neither strong or weak) to choose whatever performs best when running on a VM implementation.
> Again I just don't buy that developers will write code that way. No one wants to depend on the performance characteristics of a default that could change on every release.
> David

More information about the valhalla-dev mailing list