Member-only story

The 6 most common OOM issues at work

Beck Moulton
5 min readJun 18, 2024

--

Today, let’s talk about 6 scenarios where OOM issues occur in online services. I hope it will be helpful to you.

Heap memory OOM

Heap memory OOM is the most common type of OOM.

The exception information for heap memory OOM issues is as follows:

java.lang.OutOfMemoryError: Java heap space

This OOM is due to the maximum heap value in the JVM, which is no longer sufficient.

For example:

public class HeapOOMTest {    public static void main(String[] args) {
List<HeapOOMTest> list = Lists.newArrayList();
while (true) {
list.add(new HeapOOMTest());
}
}
}

A list collection is created here, and objects are continuously added to it in an infinite loop.

Execution result:

A heap memory overflow occurred with java.lang. OutOfMemoryError: Java heap space.

Many times, when exporting a large amount of data from Excel at once and querying too much data at once in the program, this OOM problem may occur.

We must avoid this situation in our daily work.

2-Stack memory OOM

--

--

Beck Moulton
Beck Moulton

Written by Beck Moulton

Focus on the back-end field, do actual combat technology sharing Buy me a Coffee if You Appreciate My Hard Work https://www.buymeacoffee.com/BeckMoulton

No responses yet