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

ASF GitHub Bot commented on BROOKLYN-528:
-----------------------------------------

GitHub user aledsage opened a pull request:

    https://github.com/apache/brooklyn-server/pull/808

    BROOKLYN-528: same proxy class for all entities of type

    Fixes https://issues.apache.org/jira/browse/BROOKLYN-528
    
    As well as fixing the space leak and decreasing the memory usage, this 
improves performance of entity creation from about 90 per second to about 230 
per second (on my laptop).

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

    $ git pull https://github.com/aledsage/brooklyn-server BROOKLYN-528

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

    https://github.com/apache/brooklyn-server/pull/808.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 #808
    
----
commit a635dc039123af948d9d7e95b71bf9db0b4678a1
Author: Aled Sage <[email protected]>
Date:   2017-08-31T10:00:46Z

    BROOKLYN-528: same proxy class for all entities of type

----


> Memory leak: proxy class (and java.lang.reflect.* instances) per entity
> -----------------------------------------------------------------------
>
>                 Key: BROOKLYN-528
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-528
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.11.0
>            Reporter: Aled Sage
>            Assignee: Aled Sage
>
> There is a memory leak when creating and deleting entities.
> After creating and then deleting a really simple app many times, there are a 
> lot of classes with names like {{class com.sun.proxy.$Proxy10033}} (probably 
> one per entity we created!). This also leads to a huge number of instances of 
> things like {{java.lang.reflect.Method}}.
> e.g. deploy and delete the app:
> {noformat}
> services: 
> - type: org.apache.brooklyn.entity.stock.BasicApplication
> {noformat}
> ---
> Looking at the code in 
> {{org.apache.brooklyn.core.objs.proxy.InternalEntityFactory.createEntityProxy()}},
>  when it calls {{java.lang.reflect.Proxy.newProxyInstance}} it first creates 
> a new {{AggregateClassLoader}} instance and passes that in. This causes 
> {{newProxyInstance}} to create a new class every time.
> The fix should be simple: to reuse {{AggregateClassLoader}} instances, rather 
> than creating new ones.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to