LSan identified another memory leak. JfrUpcalls::on_retransform uses os::malloc to allocate bytes for ClassFileStream. However ClassFileStream does not take ownership of the bytes. Based on JfrUpcalls::new_bytes_eager_instrumentation it should have used NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_NULL. However for some reason JfrUpcalls::on_retransform creates another ResourceMark, even though the caller already created one. I believe the correct approach should be to remove the ResourceMark in JfrUpcalls::on_retransform and use NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_NULL.
- relates to
-
JDK-8282420 JFR: Remove event handlers
- Resolved