You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Aled Sage (JIRA)" <ji...@apache.org> on 2017/08/31 08:42:00 UTC

[jira] [Updated] (BROOKLYN-528) Memory leak: proxy class (and java.lang.reflect.* instances) per entity

     [ https://issues.apache.org/jira/browse/BROOKLYN-528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aled Sage updated BROOKLYN-528:
-------------------------------
    Description: 
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.


  was:
There is a memory leak when creating and deleting entities.

After creating and then deleting a really simple app many times ({{services: [{type: org.apache.brooklyn.entity.stock.BasicApplication}]}}), 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}}.

---
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.



> 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)