> > If you examine the code you will see that the PrepStmt (prepared statement)
> > instance is derived from RS (result set) which holds onto a reference to
> > a Conn (connection). So the PrepStmt, RS or Conn will not be finalized as
> > long as any of these instances are being referenced by some object in
> > any thread.
> 
> The fact that PrepStmt references a Conn means than Conn won't be
> finalized if PrepStmt is alive, but PrepStmt may be finalized during
> execution of another statement, when there's no more references to it,
> but there are references to other PrepStmt or Stmt. And this actually
> does happen.

Yeah, I see your point.

I assumed that Conn also kept references to the PrepStmt instances, but it 
appears they are GC-able weak refs:

    public PreparedStatement prepareStatement(
            String sql, int rst, int rsc, int rsh) throws SQLException {
        checkCursor(rst, rsc, rsh);
        PrepStmt prep = new PrepStmt(this, sql);
        stmts.add(new WeakReference(prep));
        return prep;
    }

Perhaps Conn could enqueue "closed" PrepStmt instances into a 
"to-be-closed" list using normal references and later serially 
invoke sqlite3_finalize on them at safe points such as in Conn.close 
and just prior to executing other statements.



 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLiteJDBC" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlitejdbc?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to