SQLite Forum

Results from callcatcher run on SQLite
Login
While learning how debugging works under SQLite, I briefly wondered if there might be lots of unused code. There isn't, but to check I ran [callcatcher](https://github.com/caolanm/callcatcher) on trunk, and that might be interesting to others. 

callcatcher reports 4 unused functions, which although correct doesn't mean they can all be removed:

<code>
export CC="callcatcher gcc"
export AR="callarchive ar"
./configure && make
callanalyse ./sqlite3
sqlite3MemTraceDeactivate
sqlite3_global_recover
sqlite3_memory_alarm
sqlite3_shutdown
</code>

Ignoring calls in test*c, look at the code I see:

ext/misc/memtrace.c:sqlite3MemTraceDeactivate() is not called regardless of SQLITE_DEBUG, although I don't yet understand memory tracing. So maybe it can be removed.

main.c/sqlite3_global_recover() is unused. loadext.c has a comment saying sqlite3_global_recover() is deprecated, but I see it isn't in the public SQLite interface. I think it can be removed.

malloc.c/sqlite3_memory_alarm() is unused, however it is an SQLITE_DEPRECATED function in the public interface in sqlite.h.in. This means it cannot be removed.

main.c/sqlite3_shutdown() is almost unused. It is discussed in comments, and if -DTCLSH is specified, it is called at the end of tclsqlite.c, but I can't see why it is specially needed there. So it can probably be removed?

Dan