Cannot unload plugin with java records

Answered

Hi,

I have an unloading issue with my dynamic plugin. As soon as the plugin contains any Java record, it cannot be unloaded anymore due to the following classloader leak:

  ROOT: Sticky class
  java.lang.runtime.ObjectMethods.OBJECT_EQ
  java.lang.invoke.DirectMethodHandle.asTypeCache
  java.lang.invoke.DirectMethodHandle.type
  java.lang.invoke.MethodType.ptypes
  java.lang.Class[]
  com.example.recorddemo.DemoIndex$IndexData.<loader>
* com.intellij.ide.plugins.cl.PluginClassLoader

The record in this trace is com.example.recorddemo.DemoIndex$IndexData. I've shared an example project to reproduce the issue here: https://github.com/jhonnen/intellij-plugin-record-leak

Heap Dump: Upload id: 2022_10_10_NbwHDtKD8isaWbXrUA1sJZ (file: unload-com.example.record-demo-10.10.2022_10.47.16.hprof)

Is this a known issue? Are there any workarounds (except for replacing the record)?

3 comments
Comment actions Permalink

Thanks for reporting. Could you please file an issue in https://youtrack.jetbrains.com/issues/IDEA with the link to your repro, mem-dump is not necessary.

0
Comment actions Permalink

For now, please avoid using records.

0

Please sign in to leave a comment.