[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ob3pedv9.fsf@sejong.aot.lge.com>
Date: Mon, 06 Jan 2014 17:03:22 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung.kim@....com>,
LKML <linux-kernel@...r.kernel.org>,
Arun Sharma <asharma@...com>,
Frederic Weisbecker <fweisbec@...il.com>,
Rodrigo Campos <rodrigo@...g.com.ar>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter
On Sun, 5 Jan 2014 16:55:10 +0100, Jiri Olsa wrote:
> On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote:
>> From: Namhyung Kim <namhyung.kim@....com>
>
> SNIP
>
>> +
>> +out:
>> + iter->curr++;
>> + return err;
>> +}
>> +
>> +static int
>> +iter_finish_branch_entry(struct add_entry_iter *iter,
>> + struct addr_location *al __maybe_unused)
>> +{
>> + free(iter->priv);
>> + iter->priv = NULL;
>
> so branch_info is duplicated in the hist_entry__new.. it's not
> easy to find why this one gets freed while mem_info stays ;-)
The branch_info is an array and each entry gets its own part in the
array - so entries alloc & copy the (part of) branch info as the branch
info iterated. But mem info is a single data for a single entry so a
new entry steals ownership of the mem info when created and not freed.
Maybe we can alloc & copy another mem info when adds an entry and free
the original at iter->finish_entry(), but I felt it's unnecessary..
>
> some comment about that here would help
How about this?
/*
* The mem_info was either already freed in add_hist_entry() or
* passed to a new hist entry by hist_entry__new().
*/
Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists