RFR: 8215451: JNI IsSameObject should not keep objects alive
Kim Barrett
kim.barrett at oracle.com
Mon Dec 17 05:15:01 UTC 2018
> On Dec 17, 2018, at 12:03 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
>
>> On Dec 15, 2018, at 5:41 AM, Per Liden <per.liden at oracle.com> wrote:
>>
>> JNI IsSameObject should resolve the JNIHandles its comparing without keeping the objects they point to alive. Otherwise, checking if a jweak is reachable by doing IsSameObject(jweak, NULL) will be counter productive, as it will make sure that jweak stays alive.
>>
>> This is currently only a problem when using ZGC, which does concurrent jweak processing.
>>
>> This was found by the "test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadTest.java" test, which keeps a list of jweaks, which it will periodically iterate over and do IsSameObject(jweak, NULL) to determine if any of them have been cleared. The end result is the these jweaks will never be cleared and the heap eventually gets full and an OOME is thrown.
>
> I don't see what this has to do with concurrent reference processing
> or ZGC specifically. Based on that description, it seems to me SATB
> collectors like G1 and Shenandoah should have the same problem.
Maybe the reason this test is working for G1 is that the objects referred
to by the jweaks are (mostly) dying young?
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8215451
>> Webrev: http://cr.openjdk.java.net/~pliden/8215451/webrev.0
>>
>> /Per
More information about the hotspot-runtime-dev
mailing list