-
Bug
-
Resolution: Fixed
-
P4
-
18
-
b21
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8307189 | 17.0.9-oracle | Calvin Cheung | P4 | Resolved | Fixed | b01 |
JDK-8301242 | 17.0.7 | Thomas Stuefe | P4 | Resolved | Fixed | b01 |
There are two mechanisms in place in Metaspace to return memory to the OS:
1) purging the list of mappings
2) uncommitting free chunks
(1) is the old way, existing since the inception of Metaspace. It works by unmapping and deleting mapping segments which are fully evacuated. Metaspace allocations are fine granular and cannot move, so Metaspace is subject to fragmentation. That fragmentation makes (1) rather ineffective, since we only can unmap a mapping which had been fully free'd after class unloading. The mappings however are quite large (and we plan to make them larger still), the chance of one being completely empty is small.
(2) was introduced with JEP-387 and is much more effective. We return memory not on a mapping level, but on a chunk level, by uncommitting free chunks larger than a certain threshold. That works very well.
When working on JEP-387, I left (1) in place out of caution. But (1) is really not needed anymore. It has barely any effect in combination with (2).
Removing (1) would have the following advantages:
- a nice reduction in code complexity
- reduce the work we do during class unloading
- the mapping list then would only ever grow, never shrink, which would simplify lockless accesses (see
- (1) stands in the way of other improvements, e.g. the increase of the mapping size of individual mappings, which would have diminished the effectiveness of (1) even further.
Removing the ability to purge the mapping list means we retain the *uncommitted* virtual address space of those mappings after spikes in class unloading. But the consequences of that are minimal, it does not affect RSS at all.
- backported by
-
JDK-8301242 Don't purge metaspace mapping lists
-
- Resolved
-
-
JDK-8307189 Don't purge metaspace mapping lists
-
- Resolved
-
- blocks
-
JDK-8275704 Metaspace::contains() should be threadsafe
-
- Resolved
-
- relates to
-
JDK-8276086 Increase size of metaspace mappings
-
- Resolved
-
-
JDK-8271124 CTW tests crashed with assert(is_valid_method(o)) failed: should be valid jmethodid
-
- Closed
-
- links to
-
Commit openjdk/jdk17u-dev/f6ad61c0
-
Commit openjdk/jdk/3ff085e2
-
Review openjdk/jdk17u-dev/1048
-
Review openjdk/jdk/6036