Q- What is OutOfMemoryError Exception In Java?
OutOfMemoryError is a runtime error in Java which occurs when the Java Virtual Machine (JVM) is unable to allocate an object due to insufficient space in the Java heap. The Java Garbage Collector (GC) cannot free up the space required for a new object, which causes a java.lang.OutOfMemoryError
Understand the OutOfMemoryError Exception
Types of OutOfMemoryError in java
Q- Can we handle OutOfMemoryError in Java?
Types of OutOfMemoryError in java
- java.lang.OutOfMemoryError: Java heap space.
- java.lang.OutOfMemoryError: PermGen space.
- java.lang.OutOfMemoryError: GC overhead limit exceeded.
- java.lang.OutOfMemoryError: unable to create new native thread.
- java.lang.OutOfMemoryError: Requested array size exceeds VM limit.
- java.lang.OutOfMemoryError: requested bytes for Chunk::new. Out of swap space
- java.lang.OutOfMemoryError: (Native method)
Q- Can we handle OutOfMemoryError in Java?
Q- What is a StackOverflowError?
StackOverflowException is an runtime error
StackOverflowException is thrown for execution stack overflow errors, typically in case of a very deep or unbounded recursion. So make sure your code doesn't have an infinite loop or infinite recursion.
Q- Difference between StackOverflowError and outofmemoryerror in java?
No comments:
Post a Comment