I’m getting a memory leak somewhere in my program, and using some tools I think this is the location in my code. So, is there something wrong with this function and how the stored procedure is called?
CustomSQLConn is given to the class when it is created.
private void flagDeleted(ABCDocument mydoc){
try {
ResultSet rs1 = null;
try{
CallableStatement cs1;
cs1 = CustomSQLConn.prepareCall("{ call flagFolderDeleted(?) }");
cs1.setInt(1, mydoc.getId());
cs1.execute();
}catch (Exception e){
System.out.println("Got an exception: " + e.getMessage());
e.printStackTrace();
}finally{
if(rs1 != null) rs1.close();
rs1 = null;
}
}catch (Exception e) {
System.out.println("Got an exception: " + e.getMessage());
e.printStackTrace();
}
} // END flagDeleted
The connection is not being closed here either, since the class uses it for other processes.
You are closing the
ResultSetbut not closing theCallableStatement.