Adrian Crum wrote:
> --- On Thu, 3/25/10, Adam Heath <doo...@brainfood.com> wrote:
>> Adrian Crum wrote:
>>> I have been working on some ideas with the goal of
>> making Groovy a
>>> viable alternative to mini-language. I already
>> committed some code that
>>> allows methods within a Groovy script to be called, so
>> that multiple
>>> services can be included in one file - just like in
>> Java or mini-language.
>>
>> Be very very careful.  If you do this, you'll increase
>> permgen usage.
>>  Each groovy script is a class, and if those classes are
>> kept around,
>> they'll take up precious permgen space.
> 
> One of the things I noticed about the existing GroovyUtil code is that a 
> class loader instance is created for each class. I'm sure the code was copied 
> from a Groovy tutorial or code example. Each class loader instance holds a 
> reference to the thread's class loader. I'm not a permgen memory expert, but 
> it appears to me that way of doing things will result in memory leaks.

No, that's on purpose, and as designed.  If they all share the same
classloader, then you can't garbage collect any class, without
throwing them *all* away.

Reply via email to