[rules-users] Drools Objects not released from heap

dmiller44 dmiller at versatile.com
Wed Jul 28 13:57:07 EDT 2010


Hello, 

I have a weird issue, and I'm trying to figure out if this is a bug I should
report, or an error in my rule.  I'm running an application with a heap
space (min: 512mb, max: 1024mb) that gets full and eventually overflows
relatively quickly (12hrs or less).  We insert about 112 records into a
Stateful Drools Session (Drools 5.1 CR1 released 7/22/2010) every 30seconds,
using CLOUD session type, single thread, with fireUntilHalt.

Our rules evaluate the object (A) we give it, and in some cases instantiate
a new object (B) and insert it into the session.  After processing object
(A), we retract it from the session.  

Another rule matches on object (B), and when finished, also retracts the
object. 

When I do a heap snapshot, I've noticed quite a few Drools-related classes,
along with unreleased instantiations of object(A) & object(B) (more of the
latter).  Obviously I have to take into consideration that objects are being
inserted at the time of the snapshot, but over a couple hours I'll have
1000's of these objects.  I've found the only fix to be to release the
session.

I should note - calling session.getObjects() shows an empty list (size 0).

Is this a bug? When retract is called, shouldn't it free up the FactHandle &
Object to be collected?  And is instantiating an object in a rule incorrect
for some reason?

Below is a small chart of classes - the number of instances - and space
taken. (TemperatureEvent represents object (A), while AssetShallowRemote
represents object (B))  Any input would be appreciated.

Dan


| Class                                                        | Instances |    
Size |   |
|--------------------------------------------------------------+-----------+----------+---|
| java.lang.String                                             |   1155258 |
41589288 |   |
| char[]                                                       |   1153540 |
91560120 |   |
| java.util.concurrent.LinkedBlockingQueue$Node                |    329989 |
10559648 |   |
| java.util.LinkedHashMap$Entry                                |    153489 | 
9209340 |   |
| java.util.HashMap$Entry                                      |    151929 | 
6684876 |   |
| java.sql.Timestamp                                           |    117017 | 
4212612 |   |
| org.drools.reteoo.LeftTuple                                  |     53395 | 
8756780 |   |
| org.drools.common.AgendaItem                                 |     53390 | 
5819510 |   |
| org.drools.retoo.RightTuple                                  |     53386 | 
5125056 |   |
| my.test.package.AssetShallowRemote     |     42995 | 11780630 |   |
| org.drools.common.DefaultFactHandle                          |     37273 | 
3280024 |   |
| org.drools.core.util.ObjectHashSet$ObjectEntry               |     37273 | 
1341828 |   |
| org.drools.common.PropagationContextImpl                     |     32721 | 
2683512 |   |
| org.drools.core.util.ObjectHashMap$ObjectEntry               |     32721 | 
1639924 |   |
| my.test.package.TemperatureEvent                     |      7165 |  
917120 |   |

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Objects-not-released-from-heap-tp1002541p1002541.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list