-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJEP318MemoryPolluter.java
More file actions
24 lines (19 loc) · 907 Bytes
/
JEP318MemoryPolluter.java
File metadata and controls
24 lines (19 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.ibrahimatay;
public class JEP318MemoryPolluter {
// JEP 318: Epsilon: A No-Op Garbage Collector
// https://openjdk.org/jeps/318
// Understanding the JDK’s New Superfast Garbage Collectors (-XX:+UseZGC)
// https://blogs.oracle.com/javamagazine/post/understanding-the-jdks-new-superfast-garbage-collectors
// Epsilon: The JDK’s Do-Nothing Garbage Collector (-XX:+UseEpsilonGC)
// https://blogs.oracle.com/javamagazine/post/epsilon-the-jdks-do-nothing-garbage-collector
static final int GIGABYTE = 1024 * 1024 * 1024;
static final int ITERATIONS = 100;
public static void main(String[] args) {
System.out.println("Starting allocations...");
// allocate memory 1GB at a time
for (int i = 0; i < ITERATIONS; i++) {
var array = new byte[GIGABYTE];
}
System.out.println("Completed successfully");
}
}