Java Code Examples for sun.hotspot.WhiteBox#freeMetaspace()

The following examples show how to use sun.hotspot.WhiteBox#freeMetaspace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestCMSClassUnloadingEnabledHWM.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit.
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  // Wait for at least one GC to occur. The caller will parse the log files produced.
  GarbageCollectorMXBean cmsGCBean = getCMSGCBean();
  while (cmsGCBean.getCollectionCount() == 0) {
    Thread.sleep(100);
  }

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 2
Source File: TestG1ClassUnloadingHWM.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  long youngGenSize = Long.parseLong(args[1]);
  triggerYoungGCs(youngGenSize);

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 3
Source File: TestCMSClassUnloadingEnabledHWM.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit.
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  // Wait for at least one GC to occur. The caller will parse the log files produced.
  GarbageCollectorMXBean cmsGCBean = getCMSGCBean();
  while (cmsGCBean.getCollectionCount() == 0) {
    Thread.sleep(100);
  }

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 4
Source File: TestG1ClassUnloadingHWM.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  long youngGenSize = Long.parseLong(args[1]);
  triggerYoungGCs(youngGenSize);

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 5
Source File: TestCMSClassUnloadingEnabledHWM.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit.
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  // Wait for at least one GC to occur. The caller will parse the log files produced.
  GarbageCollectorMXBean cmsGCBean = getCMSGCBean();
  while (cmsGCBean.getCollectionCount() == 0) {
    Thread.sleep(100);
  }

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 6
Source File: TestG1ClassUnloadingHWM.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  long youngGenSize = Long.parseLong(args[1]);
  triggerYoungGCs(youngGenSize);

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 7
Source File: TestCMSClassUnloadingEnabledHWM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit.
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  // Wait for at least one GC to occur. The caller will parse the log files produced.
  GarbageCollectorMXBean cmsGCBean = getCMSGCBean();
  while (cmsGCBean.getCollectionCount() == 0) {
    Thread.sleep(100);
  }

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 8
Source File: TestG1ClassUnloadingHWM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  long youngGenSize = Long.parseLong(args[1]);
  triggerYoungGCs(youngGenSize);

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 9
Source File: TestCMSClassUnloadingEnabledHWM.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit.
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  // Wait for at least one GC to occur. The caller will parse the log files produced.
  GarbageCollectorMXBean cmsGCBean = getCMSGCBean();
  while (cmsGCBean.getCollectionCount() == 0) {
    Thread.sleep(100);
  }

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 10
Source File: TestG1ClassUnloadingHWM.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  long youngGenSize = Long.parseLong(args[1]);
  triggerYoungGCs(youngGenSize);

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 11
Source File: TestCMSClassUnloadingEnabledHWM.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit.
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  // Wait for at least one GC to occur. The caller will parse the log files produced.
  GarbageCollectorMXBean cmsGCBean = getCMSGCBean();
  while (cmsGCBean.getCollectionCount() == 0) {
    Thread.sleep(100);
  }

  wb.freeMetaspace(null, metaspace, metaspace);
}
 
Example 12
Source File: TestG1ClassUnloadingHWM.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String [] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  }

  WhiteBox wb = WhiteBox.getWhiteBox();

  // Allocate past the MetaspaceSize limit
  long metaspaceSize = Long.parseLong(args[0]);
  long allocationBeyondMetaspaceSize  = metaspaceSize * 2;
  long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);

  long youngGenSize = Long.parseLong(args[1]);
  triggerYoungGCs(youngGenSize);

  wb.freeMetaspace(null, metaspace, metaspace);
}