On 15 Feb 2018, at 11:10pm, Jens Alfke <j...@mooseyard.com> wrote:

>> On Feb 15, 2018, at 10:09 AM, Simon Slavin <slav...@bigfraud.org> wrote:
>> 
>>> 1) I can't be the only programmer who learned to make paired calls ("If you 
>>> initialise something, it needs deinitializing, if you allocate something, 
>>> deallocate it.").
> 
> When a process exits, its resources are automatically cleaned up by the 
> kernel — memory and address space freed, file handles and sockets closed, 
> etc. So it’s generally unnecessary to do redundant cleanup like 
> sqlite3_shutdown* on quit, and it can actually slow things down**, especially 
> if freeing a zillion heap blocks that have been paged out or are no longer in 
> CPU caches.
> 
> —Jens
> 
> * This doesn’t apply to sqlite3_close() on a writeable database, since SQLite 
> may need to update data in the file before closing it.

Your footnote is an example of the reason I do paired calls.  I didn't write 
the SQLite API.  I don't know whether sqlite3_shutdown() does anything.  For 
all I know, sqlite3_shutdown() is the thing that deletes dead journal and 
shared memory files.  Maybe it slows things down too much to do that on 
sqlite3_close().  I don't know.

Given the way the documentation is arranged, and the lack of any mention to the 
contrary,  I will assume sqlite3_shutdown() is paired with sqlite_initialize(). 
 One of the Developer team tells me it'd not needed except for cases where your 
process isn't about to quit ?  Fine.  But that should really be in the 
documentation so people who don't read this list know it.  Because the name 
sqlite3_shutdown(), and the documentation for it, implies you should call it 
when sqlite3_initialize() has been called and you don't need SQLite any more.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to