Created attachment 759593 [details] Perm gen usage comparison - Drools 5 vs Drools 6 Description of problem: After creating KieBase, the permanent generation usage is about 50% higher with Drools 6 compared to Drools 5. The KieBase is just built so no KieSessions are being created and used. The number of loaded classes is almost identical in both versions (checked with visualvm). See the attached simple Maven reproducer and the pdf that compares the perm gen usage for Drools 6 and Drools 5. Version-Release number of selected component (if applicable): Drools 6.0.0-Beta3 (and SNAPSHOT after that) Drools 5.3.x (the exact version is BRMS-5.3.1-P02). How reproducible: Always Steps to Reproduce: 1. Run the attached Maven projects (one is for Drools 5 and one for Drools 6) - just mvn test 2. See the perm gen usage messages that are being printed on stdout. Actual results: The perm gen usage in Drools 6 is much higher compared to Drools 5. Expected results: The perm gen usage is similar in both Drools 6 and Drools 5.
Created attachment 759602 [details] Simple Maven based reproducer
Forgot to specify JDK version: $ java -version java version "1.7.0_19" OpenJDK Runtime Environment (fedora-2.3.9.4.fc17-x86_64) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
I cannot reproduce this issue. I am using the JDK Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode) running it with the following memory settings: -XX:MaxPermSize=512M -Xmx1536M The output of the attached test case with Drools 5 follows: Permgen usage: 3MiB Running loop 1 Just to be sure the code is not eliminated: packages=1 KBase building took 56s. Permgen usage: 68MiB Running loop 2 Just to be sure the code is not eliminated: packages=1 KBase building took 34s. Permgen usage: 123MiB Running loop 3 Just to be sure the code is not eliminated: packages=1 KBase building took 34s. Permgen usage: 123MiB Running loop 4 Just to be sure the code is not eliminated: packages=1 KBase building took 32s. Permgen usage: 123MiB Running loop 5 Just to be sure the code is not eliminated: packages=1 KBase building took 32s. Permgen usage: 123MiB End of the test, after manually calling GC... Permgen usage: 123MiB while with Drools 6 (using the latest available snapshot) I got: Permgen usage: 2MiB Running loop 1 10:54:41.140 [main] INFO o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT] Just to be sure the code is not eliminated: packages=3 KBase building took 67s. Permgen usage: 108MiB Running loop 2 10:55:29.392 [main] INFO o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT] Just to be sure the code is not eliminated: packages=3 KBase building took 28s. Permgen usage: 108MiB Running loop 3 10:55:55.665 [main] INFO o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT] Just to be sure the code is not eliminated: packages=3 KBase building took 24s. Permgen usage: 108MiB Running loop 4 10:56:20.417 [main] INFO o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT] Just to be sure the code is not eliminated: packages=3 KBase building took 24s. Permgen usage: 108MiB Running loop 5 10:56:45.289 [main] INFO o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT] Just to be sure the code is not eliminated: packages=3 KBase building took 23s. Permgen usage: 108MiB End of the test, after manually calling GC... Permgen usage: 108MiB This means that Drools 5 uses 123M while 6 only needs 108M.
I just reran the tests with current SNAPSHOT and the issue is indeed gone. As pointed by Mario, is has been probably fixed between beta3 and beta4 when new Classloader was introduced. Closing as fixed.
This BZ has been part of the 6.0.0 stream.
I am getting the same problem in my current project and I am using drools 6.1.0.Final version. I am assuming the above problem will be fixed in Drools 6.1.0.Final version but I am getting the same problem :( Any help would be much appreciated.