If a referenced memory object never goes away and keeps its value, use SQLITE_STATIC. e.g.: static const char id[] = "1.2.3.4.5"; If a referenced memory object goes away or looses its value, use SQLITE_TRANSIENT. e.g. examples 1 (malloc & free in user function) and 3 (stack variable) in the original post Otherwise, pass a destructor function. e.g. example 2 (malloc, pass destructor) in the original post