[BAEL-7323] JFR EXAMPLE (#15650)

Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>
This commit is contained in:
Bhaskar Ghosh Dastidar 2024-01-20 22:22:42 +05:30 committed by GitHub
parent 900ff584fe
commit 238e5fb473
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
package com.baeldung.jfrview;
import java.util.ArrayList;
import java.util.List;
public class JFRExample {
public static void main(String[] args) {
JFRExample se = new JFRExample();
se.insertToList(new ArrayList<>());
}
private void insertToList(List<Object> list) {
try {
while (true) {
list.add(new Object());
}
} catch (OutOfMemoryError e) {
System.out.println("Out of Memory. Exiting");
}
}
}