You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2016/01/25 20:42:40 UTC

[jira] [Comment Edited] (GROOVY-7733) Can't unloaded Groovy classes - PermGen Erros

    [ https://issues.apache.org/jira/browse/GROOVY-7733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15115830#comment-15115830 ] 

Pascal Schumacher edited comment on GROOVY-7733 at 1/25/16 7:41 PM:
--------------------------------------------------------------------

John missed that you are using groovy 1.0, the property was added in a 2.4. As you mentioned 1.0 is really old (it was released 9 years ago), so I fear there won't be anyone who is able to help you. Sorry about that.


was (Author: pascalschumacher):
[~itayhudedi] I guess John missed that you are using groovy 1.0, the property was added in a 2.4. As you mentioned 1.0 is really old (it was released 9 years ago), so I fear there won't be anyone who is able to help you. Sorry about that.

> Can't unloaded Groovy classes - PermGen Erros
> ---------------------------------------------
>
>                 Key: GROOVY-7733
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7733
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 1.0
>         Environment: linux,windows
>            Reporter: Itay Hudedi
>            Priority: Critical
>
> I have a legacy system that is extensively using Groovy version 1.0 and currently I can not update Groovy to an updated version. From time to time I'm getting a PermGen error due to the fact that all the Groovy classes/scripts are kept in memory even if no one is using them any more.
> I'm trying to figure out what is the correct way to unload those classes after I've finished using them.
> I'm using the following code to create the Script object:
>     GroovyShell shell=new GroovyShell();
>     Script script = shell.parse("ANY_TEXT");
>     .....
> And I'm trying the following code to unload the generated class:
>     MetaClassRegistry metaClassRegistry = MetaClassRegistry.getIntance(0);
>     metaClassRegistry.removeMetaClass(script.getMetaClass().getClass());
>     metaClassRegistry.removeMetaClass(script.getClass());
>     metaClassRegistry.removeMetaClass(script.getBinding().getClass());
>     script.setBinding(null);
>     script.setMetaClass(null);
>     script = null;
> Unfortunately, this doesn't seems to work because I keep on getting a PermGen error. How can I unloaded groovy classes and keep the PermGen size reasonable?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)