调用存储过程时内存泄漏

elc*_*ool 2 java sql memory-leaks

我在我的程序中某处出现内存泄漏,并且使用一些工具我认为这是我代码中的位置.那么,这个函数是否有问题以及如何调用存储过程?

CustomSQLConn 在创建时给予类.

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    
Run Code Online (Sandbox Code Playgroud)

此处的连接也未关闭,因为该类将其用于其他进程.

jzd*_*jzd 5

你正在关闭,ResultSet但没有关闭CallableStatement.