The rules are quite simple: If the pointer refers to static memory (preallocated string constants, global variables that you can guarantee won't change while SQLite uses them) use SQLITE_STATIC
If the pointer refers to memory obtained from sqlite3_malloc (directly or indirectly e.g. via sqlite3_mprintf() ) and you won't refer to this object again, pass sqlite3_free. If the pointer refers to memory obtained from your own allocator and you won't refer to this object again, pass your own destructor. In all other cases, pass SQLITE_TRANSIENT and, if necessary, dispose of the memory appropriately. SQLITE_TRANSIENT is safe but slow, because SQLite needs to copy the string. Passing a destructor function is faster but implies a contract to NOT USE THE POINTER AGAIN yourself. SQLITE_STATIC is fastest but implies a contract that the MEMORY WILL NOT CHANGE. -----Urspr?ngliche Nachricht----- Von: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von Bart Smissaert Gesendet: Montag, 14. Dezember 2015 20:22 An: General Discussion of SQLite Database Betreff: [sqlite] sqlite3_free needed when calling sqlite3_result_text ? Not sure if I need to call sqlite3_free after running sqlite3_result_text or if sqlite3_free should be an argument (last one) in sqlite3_result_text. Currently I am using SQLITE_TRANSIENT as the last argument, so that is after the number of bytes, but have feeling I might be doing this wrong. Thanks for any advice. RBS _______________________________________________ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: hick at scigames.at This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.