question regarding call sites and garbage collection
forax at univ-mlv.fr
Tue Mar 15 15:41:18 PDT 2011
On 03/15/2011 08:58 AM, Jochen Theodorou wrote:
> Hi all,
> assuming I have a method call x.foo(a,b), where x is of class X, a of
> class A and b of class B. And let us assume I will create a MethodHandle
> MH: X#foo(A,B). Is it now the case, that unless I don't keep a hard
> reference to MH anymore, that X, A and B cannot be garbage collected?
Not sure to understand the question.
Even if the MH is garbage collected, the classloader that load C
must be not available anymore too :)
> If I create a call site using/returning MH, won't it be naturally the
> case that I hard reference the handle?
Yes, the target of a callsite is a strong reference.
> If the callsite is inlined, won't
> that mean that then we have those types hard referenced as well and that
> I cannot do anything against that?
A callsite can be inlined more than once.
So the reference to the mh can not be dropt
> bye Jochen
More information about the mlvm-dev