title: Android: do I really need to worry about closing SQLite database instances?
body: <p>My Android application is frequently logging errors complaining that I failed to release my statements, cursors, and databases. In fact, I am explicitly releasing all of my cursors in finally{} blocks at the end of the code that uses them, and I'm closing my databases in the finalize() methods of the classes that contain them.</p>
  
  <p>The structure of my application makes it very difficult for me to explicitly call the close() method on the database object (other than in the finalizer) because, for example, the class that uses the database is not an Activity class but may be a class that is used indirectly by an Activity. So that class does not itself know when the Activity to which it is ultimately attached is being destroyed.</p>
  
  <p>Do I need to be concerned about this? Am I permentently leaking some resource by not explicitly closing my database instances? Is there any danger that something will fail to get written to the file? Does the SQLite implementation on Android do write caching? Can I turn it off or force a synchronization?</p>
  
  <p>What is the Android VM's policy regarding finalizers - are they guaranteed to run eventually?</p>
  
  <p>Frank</p>