final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_OutOfMemoryError.drl" ) ) );
final Package pkg = builder.getPackage();
RuleBase ruleBase = getRuleBase();
ruleBase.addPackage( pkg );
ruleBase = SerializationHelper.serializeObject(ruleBase);
int i = 0;
SessionConfiguration conf = new SessionConfiguration();
conf.setKeepReference( true ); // this is just for documentation purposes, since the default value is "true"
try {
for ( i = 0; i < 300000; i++ ) {
final StatefulSession session = ruleBase.newStatefulSession( conf,
null );
session.dispose();
}
} catch ( Throwable e ) {
logger.info( "Error at: " + i );