RFR: 8085903: New fix for memory leak in ProtectionDomain cache

Sean Mullan sean.mullan at oracle.com
Fri Jan 8 20:06:52 UTC 2016


Please review this fix for a memory leak in the ProtectionDomain cache 
(which maps each ProtectionDomain to their granted 
PermissionCollection). The memory leak only occurs if custom permissions 
are used in a policy file.

http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/

Custom permissions cause a chain of strong references that link back to 
the ProtectionDomain key used in the map, preventing it from being 
removed (and also preventing the custom permission's URLClassLoader from 
being garbage collected). This fix wraps the PermissionCollection in a 
SoftReference which allows the objects to be garbage collected in 
response to memory demand.

Thanks,
Sean



More information about the security-dev mailing list