Issue1522
Created on 2009-12-08.21:03:09 by rkurin, last changed 2009-12-08.21:03:09 by rkurin.
| msg5363 (view) |
Author: Roman Kurin (rkurin) |
Date: 2009-12-08.21:03:07 |
|
Executing the python script repeatedly that imports another python class
causing OOM: PermGen exception.
After investigating this further the class org.python.core.PyType has a
static "class_to_type" map that never gets cleaned up and holds
references to generated class files and that does not allow those
classes to be clean up from PermGen.
class_to_type has thousands of references to PythonPOSIXHandler$<some
number>. I believe the problem happens when python script imports a
class defined in python.
The code that causes the OOM after about 30 min with -XX:MaxPermSize=32m
is included.
Java class with the main method to run:
public class JythonProblemTest {
public static void main(String[] args) throws Exception
{
while(true)
{
PythonInterpreter inter = null;
try
{
inter = new PythonInterpreter(null, new PySystemState());
inter.execfile("python_src/test.py");
}
finally
{
if (inter!= null)
{
inter.cleanup();
}
}
}
}
}
---------------------------------------------------------------
Python script to be executed by Java main method:
from os import path
class MyClass(Exception):
'''
classdocs
'''
def __init__(self):
pass
if __name__ == '__main__' or __name__ == 'main':
pass
|
|
| Date |
User |
Action |
Args |
| 2009-12-08 21:03:09 | rkurin | create | |
|