Drools 5.1内存问题 [英] Drools 5.1 memory issues

查看:199
本文介绍了Drools 5.1内存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

流口水5.1会导致内存泄漏问题吗? 我们在调用Java代码时使用了复杂的验证规则. 每个后端加载2-3个流口水文件的请求,并为每个请求创建新的KnowledgeBase.

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();
}

这是我们的Drool规则代码

This is our code for Drool rules

推荐答案

我做了很多分析,在Drools 5.1中没有发现任何内存泄漏.如果使用状态会话,请确保在使用状态会话后调用它们.如果可能的话,也建议缓存kbase,但是按需创建它们肯定不会泄漏内存.

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.

除此之外,它就像其他任何Java应用程序一样.使用探查器找出哪个类(如果有)将您的对象实例保留在内存中.

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.

这篇关于Drools 5.1内存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆