JDK-8232112 : MDO extra_data_lock leaks during class unloading
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9,10,11,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-10-10
  • Updated: 2022-12-06
  • Resolved: 2019-10-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b20Fixed
Related Reports
Relates :  
Relates :  
Description
The MDO has an extra_data_lock. When we perform class unloading, the memory of the MDO is reclaimed, but no destructor is run. Therefore, the destructor of the extra_data_lock isn't run either. Therefore, on platforms that need to run the destructor to avoid leaks, such as macOS, will suffer from a memory leak.
Comments
The mutex implementation was quite different in 9+ until recently, so there may not be any leak issue there.
21-10-2019

MethodData::_extra_data_lock was added by JDK-8035841, linking up. This leak is therefore present since 9+.
21-10-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/eda750f21308 User: coleenp Date: 2019-10-17 11:35:41 +0000
17-10-2019

ILW = HLM = P3
15-10-2019

Both of the indirect and direct versions of PlatformMutex and PlatformMonitor have non-trivial destructors that should be run. Since metaspace allocated data is cleaned up with class unloading, embedding Mutex, which embeds PlatformMonitor, is dangerous.
11-10-2019