Question: what is outofmemoryerror in java how do you resolve it?
Answer: gc() which is known to increase free memory. You can keep checking this after a memory gobbling code executes. Easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options -Xmx512M , this will immediately solve your OutOfMemoryError.