Reputation: 1252
I have a message in a long lived application, a java.lang.OutOfMemoryError: Java heap space.
I want to know the meaning of the stack trace that is displayed after the error message; could I find the issue reading this trace? What is the meaning of the stack trace?
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapIntBuffer.<init>(Unknown Source)
at java.nio.IntBuffer.allocate(Unknown Source)
at com.sun.javafx.tk.quantum.UploadingPainter.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at com.sun.javafx.tk.RenderJob.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapIntBuffer.<init>(Unknown Source)
at java.nio.IntBuffer.allocate(Unknown Source)
at com.sun.javafx.tk.quantum.UploadingPainter.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at com.sun.javafx.tk.RenderJob.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapIntBuffer.<init>(Unknown Source)
at java.nio.IntBuffer.allocate(Unknown Source)
at com.sun.javafx.tk.quantum.UploadingPainter.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at com.sun.javafx.tk.RenderJob.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapIntBuffer.<init>(Unknown Source)
at java.nio.IntBuffer.allocate(Unknown Source)
at com.sun.javafx.tk.quantum.UploadingPainter.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at com.sun.javafx.tk.RenderJob.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Thank you.
Upvotes: 1
Views: 6224
Reputation: 7730
java.lang.OutOfMemoryError: Java heap space
Java applications are allowed to use a limited amount of memory. This limit is specified during application startup. Java memory is separated into two different regions.
These regions are called heap space and permgen:
The size of those regions is set during the Java Virtual Machine (JVM) launch by specifying parameters such as -Xmx and -XX:MaxPermSize. Here You can see how to set those parameters
If you do not explicitly set the sizes, platform-specific defaults will be used.
So – the “java.lang.OutOfMemoryError: Java heap space” error will be triggered when you try to add more data into the heap space area, but there is not enough room for it.
Note that there might be plenty of physical memory available, but if the heap size limit for this Java program has been hit, the “java.lang.OutOfMemoryError: Java heap space” error is thrown.
Causes of java.lang.OutOfMemoryError: Java heap space
The application was designed to handle a certain amount of users or a certain amount of data. Now, when the number of users or the volume of data suddenly spikes, the operation which functioned normally before the spike ceases to respond and triggers the java.lang.OutOfMemoryError: Java heap space error.
A particular type of programming error will lead your application to constantly consume more memory. Every time the leaking functionality of the application is used it leaves some objects behind into the Java heap space. Over time the leaked objects consume all of the available Java heap space and trigger the already familiar java.lang.OutOfMemoryError: Java heap space error.
Upvotes: 1
Reputation: 110
Unfortunately, the stack just represents the call that failed to allocate memory, but that might not be the cause. There might be other parts in your program that is leaking memory, or maybe you are opening a big document or if your application is web-based, too many users are running some process and they're using all the memory. jvisualvm.exe (which is included in your jdk) is an excellent tool to analyze memory.
Upvotes: 1