Is there any problem about memory leak in Rhino?

554 views
Skip to first unread message

Kyoung Min Kim

unread,
Nov 6, 2013, 4:37:50 AM11/6/13
to mozill...@googlegroups.com
My project is using Rhino.

I wonder if memory leak could happen when javascript files are converted to java bytecode continuously.
I guess that new classes are created whenever javascript files are compiled.
So it could increase classes in non-heap memory infinitely.

To be specific, when javascript code is converted to java bytecode, is new-type class created?
Otherwise is just instance created?

Does anyone know this issue?

thanks,
km

gabriel munteanu

unread,
Nov 6, 2013, 10:02:55 AM11/6/13
to mozill...@googlegroups.com
AFAIK, a new class is created when js is compiled. the non-heap memory
[PermGen space in this case] is used, but it also gets garbage
collected of the classes that are not used any more.
It doesn't grow infinitely, when it gets full it says:
Java.lang.OutOfMemoryError: PermGen space
you can control its size with -XX:MaxPermSize jvm parameter.
gabi
> --
> You received this message because you are subscribed to the Google Groups
> "mozilla-rhino" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mozilla-rhin...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Kyoung Min Kim

unread,
Nov 6, 2013, 8:32:37 PM11/6/13
to mozill...@googlegroups.com
Testing my application, classes doesn't seem to be created when js is compiled.
In my application new js files are created repeatedly and those files are compiled with Rhino.
I used JConsole and was watching classes category. No classes were increased.

Also I checked the source code of Rhino. In Rhino code, org.mozilla.javascript.Script class instance is returned after compiling js. (org.mozilla.javascript.Context.compileReader) In my opinion this doesn't mean new classes are created, does it?



2013년 11월 7일 목요일 오전 12시 2분 55초 UTC+9, jgabios 님의 말:
Reply all
Reply to author
Forward
0 new messages