On Wed, 15 Jun 2022 19:28:40 GMT, Zhengyu Gu <z...@openjdk.org> wrote:
> I could not seem to find the other solution in > [JDK-8256811](https://bugs.openjdk.org/browse/JDK-8256811) comments. Sorry, I meant [JDK-8282459](https://bugs.openjdk.org/browse/JDK-8282459). I fixed my comment above. >> src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c line 637: >> >>> 635: * been collected. >>> 636: */ >>> 637: commonRef_compact(); >> >> I think you want to be doing the `commonRef_compact()` after every gc, not >> just if some classes were unloaded. You may need to re-add the >> `garbageCollected` flag to accomplish this. > > If so, should `cbGarbageCollectionFinish()` be a better place for the call? I'm not sure. I guess this would resolve any delay in doing the compact. You wouldn't need to wait for some other event to trigger it. On the other hand, it's not that important to do this in a timely manner, and it seems safer to keep it working the way it currently does. Putting it directly in `cbGarbageCollectionFinish` skips some locking and other checks (see BEGIN_CALLBACK and END_CALLBACK). If you are confident that putting it in `cbGarbageCollectionFinish` won't cause any problem, then I'm ok with it. ------------- PR: https://git.openjdk.org/jdk/pull/9168