Fixed the Reference of the metaclass in ClassInfo.java to use a Weak…#968
Fixed the Reference of the metaclass in ClassInfo.java to use a Weak…#968NecOnIce wants to merge 1 commit intoapache:masterfrom
Conversation
…Reference now, so the Reference is cleaned up nearly immediately after freeing the last strong reference of the metaclass. Prior it was used a SoftReference which prevents the ClassLoader, the ClassInfo and the Metaclass instances from beeing garbage-collected until the JVM runs nearly into an OutOfMemoryException (PermGen). This leads to a JVM which is always near the maximum of memory usage.
|
@blackdrag Any thoughts? |
|
From my POV this is no solution. We are using soft references, because in the past a weak reference gave the class free too fast leading to the runtime constantly recreating the meta class and thus to horrible performance. Also just using a SoftReference is not supposed to prevent the class to be unloaded. There are JVM configurations that behave like this though. |
|
Sry for my very late response. The behavior which constantly recreates the metaclass is really no suitable solution and i agree that my Request therefore is no solution as well. |
|
But the metaclass has hard references on the class it is a metaclass for I thought. Therefore it should be impossible to unload the classes without also or first unloading the meta classes. The usual approach is to actually create a cache for compiled scripts and avoid the creation of the classes again and again. From what I understood in your case it can happen that you have, over a session, just two many different rules as scripts, so that this is not possible.. Which would mean you have ten thousands of them... Is that right? |
|
@NecOnIce I know this has been a long time... is this issue actually still a problem today? |


…Reference now, so the Reference is cleaned up nearly immediately
after freeing the last strong reference of the metaclass.
Prior it was used a SoftReference which prevents the ClassLoader, the ClassInfo and the Metaclass instances from beeing garbage-collected
until the JVM runs nearly into an OutOfMemoryException (PermGen). This leads to a JVM which is always near the maximum of memory usage.