On Wed, Jul 23, 2014 at 11:31 AM, Nicolás Brailovsky <
nicolasbra...@gmail.com> wrote:

> Is the memory used by sqlite3_temp_directory freed by sqlite or should it
> be freed by the user?
>
> From the documentation for sqlite3_temp_directory:
>
> ** the [temp_store_directory pragma] always assumes that any string
> ** that this variable points to is held in memory obtained from
> ** [sqlite3_malloc] and the pragma may attempt to free that memory
> ** using [sqlite3_free].
>
> From this I understand that the memory ownership gets transferred to
> sqlite, so the responsibility for clean up should be sqlite's (presumably
> in the sqlite3_shutdown function). This doesn't seem to be the case,
> though.
>
> 1. Is the memory for sqlite3_temp_directory ever cleaned up?
>

Not by SQLite.  That memory is the responsibility of the application that
allocated it.



> 2. If not, should it be?
>

No.  To do so would break legacy applications that clean it up themselves.


> 3. Could the information about the memory ownership be added to the
> documentation? I believe this would also apply to other extern-definitions
> as well.
>

I will add text encouraging people to NOT use this interface.  yes.


>
> Cheers
>
> Nicolás Brailovsky
> - Tech blog http://monoinfinito.wordpress.com
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to