[jboss-user] [jBPM] - Re: KnowledgeBase keeps links to stateful sessions after disposing

Sergii Shyika do-not-reply at jboss.com
Wed Dec 7 08:31:07 EST 2011

Sergii Shyika [http://community.jboss.org/people/sshyika] created the discussion

"Re: KnowledgeBase keeps links to stateful sessions after disposing"

To view the discussion, visit: http://community.jboss.org/message/640299#640299

Hi, Tihomir,  thank you for reply. I am observing memory leak with stateless sessions too. Here is simple code below:

public static void main(String... args) {

        KnowledgeBase base = KnowledgeBaseFactory.newKnowledgeBase();
        for (int i = 0; i ();
        for (int i = 0; i < 1000; i++) {
            list.add(new Date());
        return list;

    private static void waitForKeyPress() {
        try {
            System.in.read(new byte[2]);
        } catch (IOException e) {

Here we simply create 500 stateless sessions and insert in each "heavy" object (list of 1000 dates).
Below is jConsole screenshot made while programm waiting for second key press:

 http://community.jboss.org/servlet/JiveServlet/showImage/2-640299-17450/Memory.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2-640299-17450/450-371/Memory.png 

As you can see java process consumes ~3Mb before and 22Mb after invoiking sessions.
Below is a screenshot of my debugger, that was made  after invoiking sessions:

 http://community.jboss.org/servlet/JiveServlet/showImage/2-640299-17451/Debug.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2-640299-17451/450-415/Debug.png 

You can see that knowledge base keeps 500 references to ProcessRuntime objects.
The picture is the same when we using statefull sessions and dispose them by dispose() method.

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111207/85bc5156/attachment.html 

More information about the jboss-user mailing list