Our Counterexample with liveconnect have a memoryleak:

Executing 5000 runs of simple setting of a value with liveconnect and starting the hprof-profiler shows a memory leak:

Garbacecollector statistic

The 100000-run show this behavior:

The blue curve is the Heapspace. The red is the used Memory befor and the green curve the Memory after the garbage collection.

Does an other Implementation show an over behavior ? We tried the IBMJava2-1.4.1 :

Note that the mesure is bytes, but it shows the same behavior.

Detailed analysis with hprof

SITES BEGIN (ordered by live bytes) Thu Apr  8 14:24:40 2004
          percent          live          alloc'ed  stack class
 rank   self  accum     bytes objs     bytes  objs trace name
    1 18.24% 18.24%    240312 10013    240312 10013 316854 sun.reflect.NativeMethodAccessorImpl
    2 12.16% 30.39%    160208 10013    160208 10013 316855 sun.reflect.DelegatingMethodAccessorImpl
The stack is
TRACE 316854:
	sun.reflect.MagicAccessorImpl.(MagicAccessorImpl.java:28)
	sun.reflect.MethodAccessorImpl.(MethodAccessorImpl.java:25)
	sun.reflect.NativeMethodAccessorImpl.(NativeMethodAccessorImpl.java:20)
	sun.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:143)
	java.lang.reflect.Method.acquireMethodAccessor(Method.java:548)
	java.lang.reflect.Method.invoke(Method.java:493)
	sun.plugin.liveconnect.PrivilegedCallMethodAction.run(SecureInvocation.java:556)
	java.security.AccessController.doPrivileged(AccessController.java:Unknown line)
	sun.plugin.liveconnect.SecureInvocation$2.run(SecureInvocation.java:200)
	java.security.AccessController.doPrivileged(AccessController.java:Unknown line)
TRACE 316855:
	sun.reflect.MagicAccessorImpl.(MagicAccessorImpl.java:28)
	sun.reflect.MethodAccessorImpl.(MethodAccessorImpl.java:25)
	sun.reflect.DelegatingMethodAccessorImpl.(DelegatingMethodAccessorImpl.java:18)
	sun.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:145)
	java.lang.reflect.Method.acquireMethodAccessor(Method.java:548)
	java.lang.reflect.Method.invoke(Method.java:493)
	sun.plugin.liveconnect.PrivilegedCallMethodAction.run(SecureInvocation.java:556)
	java.security.AccessController.doPrivileged(AccessController.java:Unknown line)
	sun.plugin.liveconnect.SecureInvocation$2.run(SecureInvocation.java:200)
	java.security.AccessController.doPrivileged(AccessController.java:Unknown line)
An other Problem was the String-Argument for the JSObjectCall. We work arround and optimized it with the use of a String Buffer