How to fix OutOfMemoryError

We have a wM java service which connects to a Foxpro database thru a JDBC and runs a query, then for each record fetched it needs to validate certain fields against an Oracle8i database. So in a

while(rs.next())
we call a stored procedure in oracle using
CallableStatement cs = cn1.prepareCall("{call testprc ?, ?, ?)}");
ResultSet rs1 = cs.executeQuery();

After processing some records, it gives the following error:
Exception in thread “main” java.lang.OutOfMemoryError

We tried
rs1.close();
System.gc();
in each iteration, but the program errors out just as same.

Any ideas how to trap and fix this error.

Thanks
Kazi

Kazi this sounds familiar. The problem may be if your query or stored proc iether by design or by accident is returning insane amount of data in result set than closing result set or asking for garbage collection gc call will not help.

By the way I had similar errors in different projects and System.dc() call does not do anything for it!

rs1.close() will close result set but if data already beoing pulled into memory its no use.

This also can be unrelated problem too if you have some other messages comming to production at same time and couse OUtofMemory. I would recomend to revisit your SQL adn stored proc code see how much data it can return.

On wM Enterprise Server If Broker maxed out 262MB of space , what else could we do to avoid getting the following message:

“1143 Maximum storage limit reached for data store Broker-guar”

Hi, webf.

How big are your events? Are the messages very, very large? Or are there just a lot of small ones?

Review your events and business processes with somebody else; you may find that you are guaranteeing transactions that should be “volatile”. 262MB is a big chunk of queue to max out.

Just a thought…

To answer original OutOfMemory question, increase the MX heap size and try.