Aled Sage created BROOKLYN-528: ---------------------------------- Summary: 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
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. -- This message was sent by Atlassian JIRA (v6.4.14#64029)