Created
March 21, 2016 09:26
-
-
Save nitsanw/fe9d5db85d035ecb331b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws InterruptedException { | |
SampleLinkedQueue<Integer> q = new SampleLinkedQueue<>(); | |
q.offer(1); | |
System.gc(); // N0, N1 are promoted | |
Thread.sleep(100); | |
q.poll(); // queue is empty, N0 is dead, N1 is alive | |
while(true) { | |
for (int i = 0; i < 4096; i++) { | |
// queue size is kept at 0, but new nodes are created | |
q.offer(1); | |
q.poll(); | |
} | |
// slow the test down so we can observe with tools of our choice | |
Thread.sleep(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment