Blocks :
|
|
Blocks :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
There's a "signers" field in the VM's InstanceKlass metadata which we simply store for the JDK. This field is in all of the classes whether they have signers or not. To save space, CVM moved the signers field out to Java in a WeakHashMap. We'd like to save space in Hotspot too especially for the cases where large applications load 300K classes. Can this be done? Mail from Jiangli Zhou: "We do handle signer differently in CVM. We moved signer reference into java code and use WeakHeashMap to keep referece of the signers. I remember we discussed with Coleen earlier this year. Following is from you after you looked into the code: ==================================== I looked at the code some more and figured out that the WeakHashMap works the way you would want. Each entry is a weakref to the key (the Class instance), so the entry stays around as long as the key does, and goes away once the key is gc'd. This is what you want. It saves you from having to explicitly remove the key from a regular HashMap when the Class unloads. I think this would be a good memory optimization to apply. It allows you to get rid of the signers field for each instanceKlass. You just need to make sure it really is rare that setsigners() is ever called. Otherwise you end up using more memory for the WeakHashMap approach. "
|