Drools 5.1 memory issues

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 06:47:44

问题


Can drool 5.1 cause memory leak issues? We are using complex validation rules where we are calling java codes. Each request to backend load 2-3 drool files and new KnowledgeBase is created for each request.

Can anyone throw more light on this?

private void initRulesEngine() {
    kbase = KnowledgeBaseFactory.newKnowledgeBase();
    if (kbuilder != null) {
        kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
    }
}

public void executeRules(BaseUOW requestedUOW) {
    initRulesEngine();
    ksession = kbase.newStatefulKnowledgeSession();
    ksession.insert(requestedUOW);
    ksession.fireAllRules();
}

This is our code for Drool rules


回答1:


I did a lot of profiling and did not found any memory leak in Drools 5.1. If you are using stateful sessions, make sure you call dispose() after using them. Caching kbases is also recomended if possible, but creating them on demand should not leak memory anyway.

Other than that, it is just like any other java application. Use a profiler to find out what class (if any) is retaining your object instances in memory.



来源:https://stackoverflow.com/questions/9498502/drools-5-1-memory-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!