[Kamailio-Users] Freeing sqlops results
Henning Westerholt
henning.westerholt at 1und1.de
Mon Feb 22 14:03:26 CET 2010
On Monday 22 February 2010, Alex Balashov wrote:
> Should sql_result_free() always be called, no matter what the
> circumstance, in order to discharge memory allocated to query result
> sets and/or metadata?
>
> Or is it not necessary in certain situations, for example when script is
> broken via 'exit', i.e.
>
> sql_query("db", "SELECT ...", "res");
> if(! $dbr(res=>rows)) {
> # Is it necessary to call sql_result_free() here?
> exit;
> }
>
> Are results implicitly freed at the end of route script execution
> anyway? Are they tied to transaction persistence in any way?
Hi Alex,
my understanding of the module is that you need to call sql_result_free() afer
every successful execution of sql_query(). The sql_query structure is not
bound to any transactional behaviour or script routing logic. Daniel, please
correct me when i'm wrong here.
Old results are freed when the module is destroyed as a cleanup, during an
error of query execution and before a new query is started. But as every
single invocation of sql_query could fail, i'd not recommend it to optimize
the free operation away.
Henning
More information about the Users
mailing list