Hi,
As per Stan's mail about prepared statements, I checked the source code for DOTS test case that John ran (ATCJ2.java) to see if prepared statements are getting closed properly. I found that there are few methods in
ATCJ2.java where prepared statements are not getting closed.
The following methods have prepared statements:-
doBid()
doPut()
doUpdateItem()
The following should be added to the catch blocks of above methods.
pstmt.close();
pstmt = null;
pstmt = null;
With the above, in case there is any exception, the prepared statements will get closed properly.
In addition, in doBid() method,
pstmt.close(); and pstmt = null; should be added right after the following block.
pstmt = conn.prepareStatement(updateBidItemSQL + "'" + itemID + "'");
pstmt.setFloat(1,bidPrice);
pstmt.setInt(2,bidCount++);
updateCount = pstmt.executeUpdate();
DotsConfig.UPDATECOUNT++;
pstmt.setInt(2,bidCount++);
updateCount = pstmt.executeUpdate();
DotsConfig.UPDATECOUNT++;
Now with patch DERBY-210, there may not be any need to modify DOTS code as all garbage collection will be taken care, but in case you still see problems even after applying patch DERBY-210, you might want to give a try to modify the
ATCJ2.java.
Also, please increase heap size while running Network Server as well.
Thanks,
Ramandeep Kaur ([EMAIL PROTECTED])
On 1/27/06, Deepa Remesh <[EMAIL PROTECTED]> wrote:
On 1/27/06, John Embretsen <[EMAIL PROTECTED]> wrote:
> Friday, January 27, 2006, 6:14:12 PM, Deepa Remesh wrote:
>
> > Hi John,
>
> > After a quick read of your mail, it seems to me some of the
> > OutOfMemoryErrors you are seeing may be because of the leak described
> > in DERBY-210. I have a patch for this attached to the JIRA issue. If
> > it is okay, can you please try re-running the tests after applying
> > this patch? I think it should make some difference in the memory
> > usage.
>
> OK, I will give it a try next week, thanks!
Thanks. I saw you were running tests with 10.1.2.1. The patch attached
to DERBY-210 is for the trunk.
> Do you (or anyone else) know what kind of OutOfMemoryError you are
> seeing with regards to that Jira issue? (Java Heap Space, PermGen space,
> ...)
>
The OutOfMemoryError seen with DERBY-210 is for Java Heap Space. This
happens if an application which uses client driver does not explicitly
close statements. With 64MB heap space, I get OutOfMemoryError after
executing ~950 prepared statements.
Deepa
