Hi Sergei,
Sergei Golubchik wrote:
> Hi!
>
> On Feb 18, Davi Arnaut wrote:
>> ChangeSet@stripped, 2008-02-18 10:18:07-03:00, davi@stripped +4 -0
>> Bug#34424 query_cache_debug.test leads to valgrind warnings
>>
>> The problem is that the per-thread debugging settings stack wasn't
>> being deallocated before the thread termination, leaking the stack
>> memory. The solution is to free the per-thread debugging settings
>> stack once the thread finishes.
>
> What's wrong with DBUG_POP() as a cleanup, why do you need a special
> function for this ?
We need a special function because in this very some situation a paired
DBUG_POP() is not possible (might be possible, but in a very different
place).
> Note that it's ok to have a warning if DBUG_PUSH and DBUG_POP are not
> paired, no need to fix that. The memory leak comes from DBUG_PUSH that
> doesn't have a matching DBUG_POP. Using DBUG_POP as a cleanup seems
> appropriate.
Of course it comes from a DBUG_POP, but calling DBUG_POP unconditionally
is the same as cleaning up the house after the thread has been finished.
Also it's a pity to have to set and restore the session debug variable.
Regards,
--
Davi Arnaut, Software Engineer
MySQL Inc, www.mysql.com
Are you MySQL certified? www.mysql.com/certification