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

ASF GitHub Bot commented on CAMEL-10732:
----------------------------------------

GitHub user zregvart opened a pull request:

    https://github.com/apache/camel/pull/1414

    CAMEL-10732 Remove from all caches when Groovy ...

    ...script is removed from Camel script cache
    
    This commit wraps the `Class<Script>` in a `org.apache.camel.Service`
    before placing it in the cache so that on removal from the cache `stop`
    method would be invoked in which Groovy's `InvokerHelper` is used to
    cleanup three other caches that still hold references to the Script
    Class in question.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zregvart/camel CAMEL-10732

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1414.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1414
    
----
commit f05f319a29c4d3f8077e13877bb9b542ddd99b20
Author: Zoran Regvart <[email protected]>
Date:   2017-01-20T19:34:51Z

    CAMEL-10732 Remove from all caches when Groovy ...
    
    ...script is removed from Camel script cache
    
    This commit wraps the `Class<Script>` in a `org.apache.camel.Service`
    before placing it in the cache so that on removal from the cache `stop`
    method would be invoked in which Groovy's `InvokerHelper` is used to
    cleanup three other caches that still hold references to the Script
    Class in question.

----


> Remove from all caches when Groovy script is removed from Camel script cache
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-10732
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10732
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-groovy
>    Affects Versions: 2.16.6, 2.17.4, 2.18.1
>            Reporter: Zoran Regvart
>            Assignee: Zoran Regvart
>
> Camel's GroovyLanguage maintains a cache of Groovy class scripts up to 
> maximum of 1000 entries. When the limit of 1000 entries is reached the LRU 
> cache removes the least used ones.
> The LRU cache removes only the Script classes it does not remove all the 
> references that still remain to that class and this causes a memory leak.
> The remaining references are in Groovy metaclass registry, Groovy ClassInfo 
> reflection support cache and Java Beans Introspector cache.
> All of these can be easily removed on removal from the Camel LRU script cache 
> by invoking {{org.codehaus.groovy.runtime.InvokerHelper.removeClass}}.
> See [Groovy and Camel PermGen troubles with Java 
> 1.7|http://mail-archives.apache.org/mod_mbox/camel-users/201701.mbox/%3C1484927208612-5792865.post%40n5.nabble.com%3E]
>  on the camel-users mailing list.



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

Reply via email to