From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966765AbcA1J0t (ORCPT ); Thu, 28 Jan 2016 04:26:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33443 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966680AbcA1J0m (ORCPT ); Thu, 28 Jan 2016 04:26:42 -0500 Date: Thu, 28 Jan 2016 10:26:39 +0100 From: Jiri Olsa To: "Wangnan (F)" Cc: Jiri Olsa , acme@redhat.com, linux-kernel@vger.kernel.org, =?iso-8859-1?Q?J=E9r=E9mie?= Galarneau , Zefan Li , pi3orama@163.com Subject: Re: [PATCH] perf data: Fix releasing event_class Message-ID: <20160128092639.GE2322@krava.brq.redhat.com> References: <1453893665-20530-1-git-send-email-wangnan0@huawei.com> <56A9D887.8030508@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56A9D887.8030508@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 28, 2016 at 04:59:51PM +0800, Wangnan (F) wrote: > Hi Jiri, What's your opinion on this patch? > > Thank you. > > On 2016/1/27 19:21, Wang Nan wrote: > >A new patch of libbabeltrace [1] reveals a object leak problem in > >perf data CTF support: perf code never release event_class which is > >allocated in add_event() and stored in evsel's private field. > > > >If libbabeltrace has the above patch applied, leaking event_class > >prevent writer being destroied and flushing metadata. For example: oops, missed this one.. sry.. nice feature ;-) > > > > $ ./perf record ls > > Lowering default frequency rate to 500. > > Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate. > > perf.data > > [ perf record: Woken up 1 times to write data ] > > [ perf record: Captured and wrote 0.012 MB perf.data (12 samples) ] > > $ ./perf data convert --to-ctf ./out.ctf > > [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ] > > [ perf data convert: Converted and wrote 0.000 MB (12 samples) ] > > $ cat ./out.ctf/metadata > > $ ls -l ./out.ctf/metadata > > -rw-r----- 1 w00229757 mm 0 Jan 27 10:49 ./out.ctf/metadata SNIP > >+static void cleanup_events(struct perf_session *session) > >+{ > >+ struct perf_evlist *evlist = session->evlist; > >+ struct perf_evsel *evsel; > >+ > >+ evlist__for_each(evlist, evsel) { > >+ struct evsel_priv *priv; > >+ > >+ priv = evsel->priv; > >+ bt_ctf_event_class_put(priv->event_class); right, we missed that.. but we should also call free(priv) then also I can't see also perf_evlist__delete being called.. not sure perf_session__delete will take care of that thanks, jirka