[SR-Users] Sql_result_free() not cleaning properly

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 1 09:43:39 CEST 2020


Hello,

On 29.06.20 22:30, Alex Balashov wrote:
> On 6/29/20 4:27 PM, Henning Westerholt wrote:
>> I guess you are using sql_xquery? The sql_free_result will only free
>> a native sql result in script, not the xavp.
>
> But the XAVP goes out of scope once the transaction to which it
> pertains expires, right? And accordingly should be freed?
>
> (This also leads one to wonder: if the same XAVP name is referenced in
> a subsequent sql_xquery() call in the course of processing the same
> message, will it free and re-allocate memory for a new PV, perhaps
> contributing to unnecessary fragmentation? Or will it simply reuse the
> SHM block for the previously allocated PV?)

The xavps are destroyed automatically only at the end of transaction (or
end of processing the message, when the transaction is not created), so
if you do the sql_xquery() many times for the same message, then it adds
to the list of xavps (i.e., after the second xquery, you have xavps with
values from the 2nd and 1st xquery). If you want to clean it up in the
config, just assign $null to xavps.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla




More information about the sr-users mailing list