ClassLoader leak in MethodHandle.asType()

Remi Forax forax at univ-mlv.fr
Sat Apr 25 12:27:37 UTC 2015


On 04/25/2015 12:24 AM, Peter Levart wrote:
>
> On 04/24/2015 11:06 PM, John Rose wrote:
>> Good point.  Are you seeing a leak in practice?
>> The cache is important, especially to inexact MH.invoke.
>> — John
>
> Well, yes. I am (re)implementing annotations (proxies) using Remi's 
> Proxy2 and made it all the way except for the following failing jtreg 
> test:
>
> jdk/test/java/lang/annotation/loaderLeak/Main.java
>
> ...which made me find this issue. What I'm doing is the following:
>
> For implementing some annotation @Ann proxy's hashCode() method for 
> example, I prepare DMHs with the following signature (T)int for Ts 
> being all primitives, primitive arrays, Object[] and Object. I cache 
> them in a system class static field referenced HashMap keyed by 
> Class<T>. These are the functions that take an annotation member value 
> and map it to it's hashCode. When the value is of some Object (or 
> Object[] in case it is an array) subtype - for example when the member 
> value is an annotation of type V, I take the (Object)int DMH and 
> transform it with .asType(methodType(int.class, V.class)) to get 
> (V)int, which is necessary to further wrap it with filterArguments 
> where the filter is a member field getter of type (Ann)V so that I get 
> (Ann)int MHs as a kind of hashCodeExtractors for all annotation 
> members (I'll present the details later)...

I'm curious to see your implementation.

rgds,
Rémi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20150425/5a36d832/attachment-0001.html>


More information about the mlvm-dev mailing list