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

The following examples show how to use sun.hotspot.WhiteBox#youngGC() . 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: TestConcMarkCycleWB.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 {
    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());
}
 
Example 2
Source File: TestConcMarkCycleWB.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 {
    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());
}
 
Example 3
Source File: TestConcMarkCycleWB.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 {
    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());
}
 
Example 4
Source File: TestConcMarkCycleWB.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 {
    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());
}
 
Example 5
Source File: TestConcMarkCycleWB.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example 6
Source File: TestNoEagerReclaimOfHumongousRegions.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 7
Source File: TestNoEagerReclaimOfHumongousRegions.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 8
Source File: TestNoEagerReclaimOfHumongousRegions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 9
Source File: TestRemsetLoggingTools.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example 10
Source File: TestNoEagerReclaimOfHumongousRegions.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 11
Source File: TestNoEagerReclaimOfHumongousRegions.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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();
}