docs: private File createHeapDump(File outputDir) {
          if (hotSpotDiagnosticName == null) {
              return null;
          }
  
          File outputFile;
          try {
              // The default dump name is "java.hprof".
              outputFile = createNewFile(outputDir, "java", "hprof");
  
              platformMBeanServer.invoke(hotSpotDiagnosticName,
                                         "dumpHeap",
                                         new Object[] { outputFile.getAbsolutePath(), false },
                                         new String[] { String.class.getName(), boolean.class.getName() });
          } catch (Exception ex) {
              throw new RuntimeException(ex);
          }
  
          return outputFile;
      }