I have run into memory leak, when calling methods on Java proxy objects
returning String from the java class. Looks like JVM does not garbage
collect chunks of memory it returns to the calling PB thread. I read from
variuos JNI threads that it has something to do with the way native app
realeases memory on JVM calls. If it is not properly done jvm still thinks
that memory is being used and does not garbage collect it. Since pbjvm90.dll
is a black box, I have no way to verify it or control . I wonder if anyone
else experienced similar problems: I am running PB 9.01 Build 7204 with PB9
supplied jdk 1.4.
I have used a simple java class that has method returning 2K String with PB
calling it in a loop. I have used SysInternals process monitor to observe
the memory leak.

//***********Java Code************
public class MemoryLeak
{
public String testMemoryLeak() {
StringBuffer my_buffer = new StringBuffer(2000);
for (int i=0;i < 2000;i++) my_buffer.append("*");
return my_buffer.toString();
}
}

//***********PB code*************
EJBConnection lEJBConn
MemoryLeak lj_ml
String value
int i

If NOT IsValid(i_javavm) Then
i_javavm = CREATE JavaVM
i_javavm.CreateJavaVM("", False)
End if
lEJBConn = CREATE EJBConnection
lEJBConn.CreateJavaInstance(lj_ml, "MemoryLeak")
try
For i =0 to Dec(sle_count.text)
value = lj_ml.testmemoryleak( )
Next

catch (Exception e)
MessageBox(" Other Exception", e.getMessage())
end try