Additional information. When I removed the threads (everything executing sequentially), I got rid of the first problem above which is the index out of bounds exception. However, I am consistently getting the perm gen out of memory exception although I have plenty of it.
So, I decided to create those 7 instances of KnowledgeBase objects and not save them in memory (leave them eligible for GC) and I was able to get up to 20 instances created. When I added the statement that adds every newly created KnowledgeBase to an existing array list, that is when I got the memory exception again at around 5/6 KnowledgeBase. If I try to create KnowledgeBase instances WITHOUT adding KnowledgePackages to it (I am adding a total of 6), then I can create all KnowledgeBase successfully. I even created a whole new KnolwedgePackage array list from scratch on every creation of KnowledgeBase just to isolate any potential problems due to sharing of the array list among the newly created KnowledgeBases, and the issue remains the same (memory error). So, it is not the sharing of the array list of KnowledgePackage instances, it is not the fact that I am creating multiple KnowledgeBases in memory. It is the fact that I am creating multiple instances of KnowledgeBase objects AND adding 6 KnowledgePackage objects to each one. I max out at around 5/6 and then it fails. Here is the last run that failed (I printed out Runtime...freeMemory() and availableMemory()): Free memory: 45 MB Available memory: 254 MB Then the exception right when I wanted to add KP array list to the next KnowledgeBase. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/ArrayIndexOutOfBounds-when-calling-addKnowledgePackage-tp837841p837886.html Sent from the Drools - User mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
