From c0b4579093e30d0d186786416a54b45bfd1be8e4 Mon Sep 17 00:00:00 2001 From: fanatixan Date: Sun, 24 Feb 2019 18:09:22 +0100 Subject: [PATCH] bael-2383: memory polluting code for testing epsilon gc (#6403) --- .../com/baeldung/epsilongc/MemoryPolluter.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java diff --git a/core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java b/core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java new file mode 100644 index 0000000000..97e216513b --- /dev/null +++ b/core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java @@ -0,0 +1,18 @@ +package com.baeldung.epsilongc; + +public class MemoryPolluter { + + private static final int MEGABYTE_IN_BYTES = 1024 * 1024; + private static final int ITERATION_COUNT = 1024 * 10; + + public static void main(String[] args) { + System.out.println("Starting pollution"); + + for (int i = 0; i < ITERATION_COUNT; i++) { + byte[] array = new byte[MEGABYTE_IN_BYTES]; + } + + System.out.println("Terminating"); + } + +}