What will you do if VM exits while printing “OutOfMemoryError” and increasing max heap size doesn help?
The Java HotSpot VM cannot expand its heap size if memory is completely allocated and no swap space is available. This can occur, for example, when several applications are running simultaneously. When this happens, the VM will exit after printing a message similar to the following.Exception java.lang.OutOfMemoryError: requested bytesIf you see this symptom, consider increasing the available swap space by allocating more of your disk for virtual memory and/or by limiting the number of applications you run simultaneously. You may also be able to avoid this problem by setting the command-line flags -Xmx and -Xms to the same value to prevent the VM from trying to expand the heap. Note that simply increasing the value of -Xmx will not help when no swap space is available.
Related Questions
- What option can be specified as an argument to the jdk to increase the thread heap size used by the JDK in the context of the webserver?
- What will you do if VM exits while printing "OutOfMemoryError" and increasing max heap size doesn help?
- How do I change heap size for the VM in the Java Plug-in product?