Wednesday, 27 May 2015

Will static Object be garbage collected ?

Static Objects are per JVM/Classloader ?

Their reference resides in PermGen but actual object will be created in the Old/Young generation of heap.

Will that ever cause OOM:Heap space of OOM: Permgen space ?

If you are holding static reference to a growable Object collection, you should get OOM:Heap space not OOM: PermGen

GC'ed :
Never, till the classloader which loaded the class, itself gets GC'ed.
That never happens for default classloader

No comments:

Post a Comment