Hii,
Possible causes:
-
Simple configuration issue, where the specified heap size is insufficient for the application.
-
Application is unintentionally holding references to objects, and this prevents the objects from being garbage collected.
-
Excessive use of finalizers.
One other potential source of this error arises with applications that make excessive use of finalizers. If a class has a finalize method, then objects of that type do not have their space reclaimed at garbage collection time
After garbage collection, the objects are queued for finalization, which occurs at a later time. finalizers are executed by a daemon thread that services the finalization queue. If the finalizer thread cannot keep up with the finalization queue, then the Java heap could fill up and this type of OutOfMemoryError exception would be thrown.