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

From: Namhyung Kim
Date: Wed Jul 11 2018 - 04:14:09 EST


Hell,

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: Namhyung Kim <namhyung@xxxxxxxxxx>

Thanks,
Namhyung