DELAPARRA
Index
Color
NL
Category: Error types

OutOfMemoryError

Explained by Updated

What is OutOfMemoryError?

OutOfMemoryError: The application tried to allocate more memory (heap space) than the system has available. An out-of-memory error means the program tried to use more memory than it is allowed. In Java it is OutOfMemoryError; in PHP the message is "Allowed memory size exhausted". In containers, the system may simply kill the process, which Kubernetes reports as OOMKilled.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about OutOfMemoryError

How is OutOfMemoryError used in practice?

The usual cause is loading too much data at once: an entire table into an array, a huge file into a string, or an image far larger than needed. Memory leaks in long-running processes, such as queue workers, are the other common cause.

What should you keep in mind with OutOfMemoryError?

Raising the limit sometimes helps, but often just delays the problem. Process data in chunks, stream files instead of reading them whole, and restart long-running workers regularly. For exports and imports, Laravel's chunk(), lazy() and streamed responses keep memory use flat no matter how big the data gets.

At a glance

CategoryError types
Explained by
Updated

More Error types terms

All terms starting with O

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.