[jboss-jira] [JBoss JIRA] (DROOLS-913) Memory leak when deleting a tuple from an unlinked segment
Mario Fusco (JIRA)
issues at jboss.org
Wed Sep 16 03:29:00 EDT 2015
[ https://issues.jboss.org/browse/DROOLS-913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13109137#comment-13109137 ]
Mario Fusco commented on DROOLS-913:
------------------------------------
The fix also requires this commit https://github.com/droolsjbpm/drools/commit/3df503e5a
> Memory leak when deleting a tuple from an unlinked segment
> ----------------------------------------------------------
>
> Key: DROOLS-913
> URL: https://issues.jboss.org/browse/DROOLS-913
> Project: Drools
> Issue Type: Bug
> Reporter: Mario Fusco
> Assignee: Mario Fusco
> Fix For: 6.3.0.Final
>
>
> When deleting an object from a session all references to the object itself and the fact handle holding it should disappear. Unfortunately, as demonstrated by the test case below, in some case the deleted fact can remain as a deleted left tuple in the memory of an unlinked segment.
> {code}
> @Test
> public void testBetaMemoryLeakOnFactDelete() {
> String drl =
> "rule R1 when\n" +
> " $a : Integer(this == 1)\n" +
> " $b : String()\n" +
> " $c : Integer(this == 2)\n" +
> "then \n" +
> "end\n" +
> "rule R2 when\n" +
> " $a : Integer(this == 1)\n" +
> " $b : String()\n" +
> "then \n" +
> "end\n";
> KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL )
> .build()
> .newKieSession();
> FactHandle fh1 = ksession.insert(1);
> FactHandle fh2 = ksession.insert("test");
> ksession.fireAllRules();
> ksession.delete(fh1);
> ksession.delete(fh2);
> ksession.fireAllRules();
> NodeMemories nodeMemories = ((InternalWorkingMemory) ksession).getNodeMemories();
> for (int i = 0; i < nodeMemories.length(); i++) {
> Memory memory = nodeMemories.peekNodeMemory( i );
> if ( memory != null && memory.getSegmentMemory() != null ) {
> SegmentMemory segmentMemory = memory.getSegmentMemory();
> System.out.println( memory );
> LeftTuple deleteFirst = memory.getSegmentMemory().getStagedLeftTuples().getDeleteFirst();
> System.out.println( deleteFirst );
> assertNull( deleteFirst );
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list