Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-1638

Memory leak in ProxyFactory when using CGLIB proxies

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.6
    • Fix Version/s: 2.0 M4
    • Component/s: Core:AOP
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      I have a memory leak when using the ProxyFactory.

      This has been tested with the following configuration :

      • cglib-nodep-2.1_3.jar
      • spring 1.2RC2 and spring 1.2.6
      • IBM's JVM and SUN's JVM

      Here is the unit test to demonstrate the problem :

      import junit.framework.TestCase;

      import org.aopalliance.intercept.MethodInterceptor;
      import org.aopalliance.intercept.MethodInvocation;
      import org.springframework.aop.framework.ProxyFactory;
      import org.springframework.aop.support.NameMatchMethodPoi ntcutAdvisor;

      public class TestProxyFactoryMemoryLeak extends TestCase {

      public void testMemoryLeak() {
      Object target = new Object();
      MethodInterceptor methodInterceptor = new DummyMethodInterceptor();

      while (true)

      { ProxyFactory proxyFactory = new ProxyFactory(); NameMatchMethodPointcutAdvisor advisor = new NameMatchMethodPointcutAdvisor(methodInterceptor); advisor.addMethodName("dummy"); proxyFactory.addAdvisor(advisor); proxyFactory.setProxyTargetClass(true); proxyFactory.setTarget(target); proxyFactory.getProxy(); }

      }

      private class DummyMethodInterceptor implements MethodInterceptor {
      public Object invoke(MethodInvocation methodInvocation) throws Throwable

      { return methodInvocation.proceed(); }

      }
      }

      Thanks
      Eric Ballet-Baz

        Attachments

          Activity

            People

            • Assignee:
              robh Rob Harrop
              Reporter:
              ericbb Eric Ballet Baz
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                12 years, 18 weeks, 3 days ago