--- old/src/hotspot/share/services/virtualMemoryTracker.cpp 2020-09-04 13:57:18.093137711 +0200 +++ new/src/hotspot/share/services/virtualMemoryTracker.cpp 2020-09-04 13:57:17.717135273 +0200 @@ -667,10 +667,9 @@ mss._committed_in_bytes[type] = MetaspaceUtils::committed_bytes(type); mss._used_in_bytes[type] = MetaspaceUtils::used_bytes(type); - size_t free_in_bytes = 0;// TODO fix(MetaspaceUtils::capacity_bytes(type) - MetaspaceUtils::used_bytes(type)) - // + MetaspaceUtils::free_chunks_total_bytes(type) - // + MetaspaceUtils::free_in_vs_bytes(type); - mss._free_in_bytes[type] = free_in_bytes; + // The answer to "what is free" in metaspace is complex and cannot be answered with a single number. + // Free as in available to all loaders? Free, pinned to one loader? For now, keep it simple. + mss._free_in_bytes[type] = mss._committed_in_bytes[type] - mss._used_in_bytes[type]; } void MetaspaceSnapshot::snapshot(MetaspaceSnapshot& mss) {