有在java上用过rhino引擎的朋友吗,问个性能问题
要用java解析一些javascript代码,使用rhino引擎,过程大致如下
for(String expression : expressions) {
Context cx = Context.enter();
Scriptable scope = cx.initStandardObjects();
Object result = cx.evaluateString(scope, expression, "s", 1, null);
}
java.lang.OutOfMemoryError: PermGen space
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.mozilla.javascript.optimizer.Codegen.createScriptObject(Codegen.java:89)
at org.mozilla.javascript.Context.compileImpl(Context.java:2394)
at org.mozilla.javascript.Context.compileString(Context.java:1335)
at org.mozilla.javascript.Context.compileString(Context.java:1324)
at org.mozilla.javascript.Context.evaluateString(Context.java:1076)