From: Samuele P. <ped...@bl...> - 2001-12-17 16:13:41
|
Hi. If you're exec statements repeatedely create new classes inheriting from java, you could see memory leaks if you don't set the described option. You can check for that running your applet under the appletviewer and passing either -verbose:gc (jdk <1.3) or -verbose:class (jdk >= 1.3) to the java runtime with the -J option also -J-verbose:gc or .... And check whether the classes org.python.pycode._pyx* org.python.proxies.* dynamically created during an exec are unloaded after a while. Under jdk 1.3 a System.gc triggers also class unloading so you can add logic to the applet to trigger System.gc() for you tests. If they are not, setting the option should solve the problem, so I would redo the test with the option set to weak. Weak could have a slightly performance impact vs soft. On the other hand for debugging the problem weak is better, with weak gc force unloading, while soft will cause unloading only in case of low memory conditions. Only testing can tell you whether soft or weak is the right setting for production code wrt to performance. Anyway both should not have any kind of big impact unless your applet is very peculiar. AFAIK this is the only potential cause of leaks under Jython. Let us know if you cannot solve your problem or need further explanation. regards, Samuele Pedroni. ----- Original Message ----- From: Sells, Fred <fr...@ad...> To: <jyt...@li...> Sent: Monday, December 17, 2001 3:38 PM Subject: [Jython-users] memory leak > I have a memory leak in an applet that uses the Python.exec() method > multiple times. I though that would work since I overwrite the same Python > variable names with each invocation; however that is not the case. > contonious calls end up in a VM out of memory error > > the jython registry has the following entry. Will this solve my problem > (relating to memory leak :) )? Is there a difference between "soft" and > "weak"? > > # List of choices for internal tables impl (PyJavaClasses canonical map > etc.), > # these are separated through ':' and tryed from left to right. > # For long running applications under java2, needing classes unloading, > # in order to have jython runtime automatically discarding > # no longer needed info and avoding memory leakage, this can be set > # to weak or soft (=> an impl. using weak-refs or soft-refs will be used). > #python.options.internalTablesImpl = soft > #python.options.internalTablesImpl = weak > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |