当前位置: 首页>>代码示例>>Java>>正文


Java WhiteBox.fullGC方法代码示例

本文整理汇总了Java中sun.hotspot.WhiteBox.fullGC方法的典型用法代码示例。如果您正苦于以下问题:Java WhiteBox.fullGC方法的具体用法?Java WhiteBox.fullGC怎么用?Java WhiteBox.fullGC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.hotspot.WhiteBox的用法示例。


在下文中一共展示了WhiteBox.fullGC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
public static void main(String... args) {

        WhiteBox wb = WhiteBox.getWhiteBox();
        StringBuilder sb = new StringBuilder();
        sb.append("1234x"); sb.append("x56789");
        String str = sb.toString();

        if (wb.isInStringTable(str)) {
            throw new RuntimeException("String " + str + " is already interned");
        }
        str.intern();
        if (!wb.isInStringTable(str)) {
            throw new RuntimeException("String " + str + " is not interned");
        }
        str = sb.toString();
        wb.fullGC();
        if (wb.isInStringTable(str)) {
            throw new RuntimeException("String " + str + " is in StringTable even after GC");
        }
    }
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:21,代码来源:SanityTest.java

示例2: main

import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    WhiteBox wb = WhiteBox.getWhiteBox();

    wb.youngGC();
    assertTrue(wb.g1StartConcMarkCycle());
    while (wb.g1InConcurrentMark()) {
        Thread.sleep(5);
    }

    wb.fullGC();
    assertTrue(wb.g1StartConcMarkCycle());
    while (wb.g1InConcurrentMark()) {
        Thread.sleep(5);
    }
    assertTrue(wb.g1StartConcMarkCycle());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TestConcMarkCycleWB.java

示例3: main

import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
public static void main(String[] args) {
    int numGCs = Integer.parseInt(args[0]);

    // Perform the requested amount of GCs.
    WhiteBox wb = WhiteBox.getWhiteBox();
    for (int i = 0; i < numGCs - 1; i++) {
        wb.youngGC();
    }
    if (numGCs > 0) {
      wb.fullGC();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TestRemsetLoggingTools.java

示例4: main

import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException{
    WhiteBox wb = WhiteBox.getWhiteBox();
    LinkedList<Object> garbageAndRefList = new LinkedList<Object>();
    // Creating a 1M large byte array. Since the test specifies the heap
    // region size to be 1m this will be a humongous object. We then
    // store a pointer to the array in the static object to keep it live
    // during the whole test.
    humongous_reference_holder = new LargeRef(new byte[1 * 1024 * 1024]);

    // Create some garbage and a reference to the humongous object each round.
    for (int i = 0; i < 32; i++) {
        garbageAndRefList.add(new byte[400*1000]);
        garbageAndRefList.add(new LargeRef(humongous_reference_holder.ref()));

        // Promote to old, goal is to get rem-set entries for the humongous
        // object from different regions. The test specifies MaxTenuringThreshold=0,
        // this will make sure we get objects promoted to old at once.
        wb.youngGC();
    }
    // Clear the garbage and reference list.
    garbageAndRefList.clear();

    // Run a concurrent mark cycle to mark all references but the static one as dead.
    wb.g1StartConcMarkCycle();
    while (wb.g1InConcurrentMark()) {
        Thread.sleep(100);
    }

    // Run a young collection to make sure humongous object still can't be eagerly reclaimed.
    wb.youngGC();
    // Will crash/assert if humongous object has been reclaimed.
    wb.fullGC();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:TestNoEagerReclaimOfHumongousRegions.java


注:本文中的sun.hotspot.WhiteBox.fullGC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。