Avatar ·

What are -Xms and -Xmx parameters when starting JVM and how to configure them correctly?

Hello colleagues! I'm new to Java and encountered a problem when running my first serious application. I have a simple program that processes a large CSV file (about 500 MB). I wrote the following code:
import java.io.*;
import java.util.*;

public class CsvProcessor {
    public static void main(String[] args) throws Exception {
        List<String> lines = new ArrayList<>();
        try (BufferedReader br = new BufferedReader(new FileReader("data.csv"))) {
            String line;
            while ((line = br.readLine()) != null) {
                lines.add(line);
            }
        }
        System.out.println("Loaded lines: " + lines.size());
    }
}
When I run it with the command `java CsvProcessor`, the program