Re: [PATCH v2] perf script python: Fix dict reference counting

From: Jiri Olsa
Date: Mon Jul 09 2018 - 10:55:10 EST


On Mon, Jul 09, 2018 at 01:59:50PM +0300, Janne Huttunen wrote:
> The dictionaries are attached to the parameter tuple that steals
> the references and takes care of releasing them when appropriate.
> The code should not decrement the reference counts explicitly.
> E.g. if libpython has been built with reference debugging enabled,
> the superfluous DECREFs will trigger this error when running perf
> script:
>
> Fatal Python error: Objects/tupleobject.c:238 object at
> 0x7f10f2041b40 has negative ref count -1
> Aborted (core dumped)
>
> If the reference debugging is not enabled, the superfluous DECREFs
> might cause the dict objects to be silently released while they are
> still in use. This may trigger various other assertions or just
> cause perf crashes and/or weird and unexpected data changes in the
> stored Python objects.
>
> Signed-off-by: Janne Huttunen <janne.huttunen@xxxxxxxxx>

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

thanks,
jirka