I found the proxy maker(MakeProxies.java) create a new proxy class each time when need, even for the same class. It change the proxy class name by add a counter to the name:
String fullProxyName = proxyPrefix + proxyName + "$" + proxyNumber++;
I don't understand why this should be done, there must be some reason. But this code will cause huge number of classes been defined if you run jython script repeatly, and eventually get an OutOfMemoryError (PermGen space). So I change the code and test it, haven't get any error yet. But I'm not sure this is correct way to solve the problem. Here's my change:
String fullProxyName = proxyPrefix + proxyName + "$" + proxyNumber;//++; //NOT change the proxy class name
// check if the proxy class has been created
Class pc = (Class) proxies.get
if (pc != null)
// create the proxy class ...
Anyone has idea about this?