Hi Jochen,

I did have a situation in the past where softly referenced class loaders would 
cause an OutOfMemoryError. This can happen when you have plenty of memory in 
the ordinary heap, but the permgen has filled up. The reason for this is that 
soft references are cleared based on how full the ordinary heap is and don't 
take the fullness of permgen into account. You can have your permgen filled 
with only soft reachable classes, but as long as you have plenty of ordinary 
heap available, those soft references won't be cleared, and you might be unable 
to load new classes. I have battled one case of this about a year and a half 
ago; my workaround was to find a ratio by trial and error for the size of the 
permgen to the size of the heap; this is of course application-specific. You 
can make the OutOfMemoryError in permgen go away by either increasing permgen 
size, or a bit paradoxically sounding, by reducing your ordinary heap size :-) 
Actually, if you want to test whether this was indeed the problem, then 
reducing the ordinary heap might be a better strategy than growing permgen. 

I agree that this is, in all likeness, a GC bug - the JVM should clear the soft 
references and then collect the ordinary heap + permgen before throwing an OOME 
for permgen. I don't remember filing a bug about this though… I think it'd be 
worth it, though.

Cheers,
  Attila.

On Jan 24, 2011, at 6:13 AM, Jochen Theodorou wrote:

> Hi all,
> 
> we have recently found some strange behaviour in an application where I don't 
> have access to directly, but a dump is available. The problem is a permgen 
> problem and there seem to be many loaders and classes, that are weak/soft 
> reachable. So I wonder why the permgen problem happened at all. This could be 
> of course a problem in the program used to find this. So I wonder how to 
> approach best this issue.
> 
> Since runtime generating classes is a common thing for us language guys, I 
> have the hope some one here could give me some advice.
> 
> bye Jochen
> 
> -- 
> Jochen "blackdrag" Theodorou
> The Groovy Project Tech Lead
> http://blackdragsview.blogspot.com/
> For Groovy programming sources visit http://groovy.codehaus.org

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to