This project show how it is possible to have memory leak problems using sublist method from java.util.List.
➡️ Project clone
git clone https://github.com/Lubrum/java-sublist-memory-leak.git
➡️ Go to the new folder
cd java-sublist-memory-leak
➡️ Run commands below
javac src/ObjectSizeFetcher.java
jar cmf MANIFEST.MF object-size-fetcher.jar src/ObjectSizeFetcher.class
➡️ Add following arguments before run or run 'start' on IntelliJ
-Xms200m -Xmx200m -javaagent:/home/lu/sys/memory-leak/java-sublist/out/artifacts/java_sublist_jar/java-sublist.jar
Explained in portuguese (PT-BR) in this video: https://youtu.be/6zn4k8S-By4