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

Yang Jiandan updated HADOOP-8605:
---------------------------------

    Description: 
TestReflectionUtils.testCacheDoesntLeak() uses different urlClassLoader to load 
TestReflectionUtils$LoadedInChild by a for cycle:

    int iterations=9999;

    for (int i=0; i<iterations; i++) {

      URLClassLoader loader = new URLClassLoader(new URL[0], 
getClass().getClassLoader());

      Class cl = 
Class.forName("org.apache.hadoop.util.TestReflectionUtils$LoadedInChild", 
false, loader);

      Object o = ReflectionUtils.newInstance(cl, null);

      assertEquals(cl, o.getClass());

    }

but every time it generate the same class


  was:
TestReflectionUtils.testCacheDoesntLeak() uses different urlClassLoader to load 
TestReflectionUtils$LoadedInChild by a for cycle:
    int iterations=9999; // very fast, but a bit less reliable - bigger numbers 
force GC
    for (int i=0; i<iterations; i++) {
      URLClassLoader loader = new URLClassLoader(new URL[0], 
getClass().getClassLoader());
      Class cl = 
Class.forName("org.apache.hadoop.util.TestReflectionUtils$LoadedInChild", 
false, loader);
      Object o = ReflectionUtils.newInstance(cl, null);
      assertEquals(cl, o.getClass());
    }
but every time it generate the same class


    
> TestReflectionUtils.testCacheDoesntLeak() can't illustrate ReflectionUtils 
> don't generate memory leak
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-8605
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8605
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 1.0.3
>            Reporter: Yang Jiandan
>
> TestReflectionUtils.testCacheDoesntLeak() uses different urlClassLoader to 
> load TestReflectionUtils$LoadedInChild by a for cycle:
>     int iterations=9999;
>     for (int i=0; i<iterations; i++) {
>       URLClassLoader loader = new URLClassLoader(new URL[0], 
> getClass().getClassLoader());
>       Class cl = 
> Class.forName("org.apache.hadoop.util.TestReflectionUtils$LoadedInChild", 
> false, loader);
>       Object o = ReflectionUtils.newInstance(cl, null);
>       assertEquals(cl, o.getClass());
>     }
> but every time it generate the same class

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to