我从jtds-1.2.5.jar升级到jtds-1.3.1.jar。在此之后,我可以看到JVM在其堆中占用更多内存。
请查看此代码:
PreparedStatement ptmt = null;
query = "select * from table1";
try {
while (<condition>)
{
pstmt = connection.prepareStatement(query); //**creating huge amount of instance and failed to close in loop**
}
}
catch (Exception ex) {}
finally {
<pstmt close statement>
}
我的问题是,创建大量实例怎么样?