harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5697) [classlib][luni] ObjectStreamClass may block class unloading
Date Tue, 08 Apr 2008 06:21:26 GMT
[classlib][luni] ObjectStreamClass may block class unloading
------------------------------------------------------------

                 Key: HARMONY-5697
                 URL: https://issues.apache.org/jira/browse/HARMONY-5697
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Alexey Varlamov
            Priority: Trivial


ObjectStreamClass keeps a  global cache of created instances thus must care to support class
unloading.
It tries to do so via weak references to j.l.Class instances:
private static final WeakHashMap<Class<?>, ObjectStreamClass> classesAndDescriptors
= new WeakHashMap<Class<?>, ObjectStreamClass>();
private transient WeakReference<Class<?>> resolvedClass;

However it still keeps strong links to methods of a wrapped class: 
private transient Method methodWriteReplace; 
private transient Method methodReadResolve; 
private transient Method methodWriteObject; 
private transient Method methodReadObject; 
private transient Method methodReadObjectNoData; 
Implementation of j.l.r.Method may vary from VM to VM, but most probably it is strongly tied
to the reflected class (it is for DRLVM). IMO it is reasonable by design, class should not
be eligible for unloading if it's method is in use.

Therefore, the above fields of ObjectStreamClass must be weakly referenced as well. I did
not try to prove this finding with regression test though - it may be non-trivial to write.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message