Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/6] Move notif_queue to remote_state
Date: Wed, 02 Oct 2013 01:54:00 -0000	[thread overview]
Message-ID: <524B7C65.3030005@codesourcery.com> (raw)
In-Reply-To: <5249B011.1080207@redhat.com>

On 10/01/2013 01:08 AM, Pedro Alves wrote:
>> -static void
>> >-notif_xfree (struct notif_client *notif)
> ...
>> >-  if (notif->pending_event != NULL
>> >-      && notif->pending_event->dtr != NULL)
>> >-    notif->pending_event->dtr (notif->pending_event);
> Hmm, it's not clear to me from reading the patch where is
> pending_event released after this patch.  Could you help
> me understand that?

Since notif_queue is a global variable, we've never used QUEUE_free to
free notif_queue, so notif_xfree is never called, and pending_event on 
each notif_client is not released.

When we move notif_queue to 'remote_notif_state', we have to explicitly 
use QUEUE_free to free notif_queue and elements in it.  We put the 
pointer of each notif_client to notif_queue, so we don't need a function 
to free the notif_client when notif_queue is destroyed.  So the 
notif_queue is allocated like this,

notif_state->notif_queue = QUEUE_alloc (notif_client_p, NULL);

and notif_xfree is not needed any more.  The leak on pending_event is 
still there, but it is fixed by the next patch, which moves 
pending_event to remote_notif_state, and pending_event is freed in 
remote_notif_state_xfree.

-- 
Yao (齐尧)


  parent reply	other threads:[~2013-10-02  1:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19  1:56 [PATCH 0/6 V5] MI notification on trace started/stopped Yao Qi
2013-08-19  1:56 ` [PATCH 5/6] MI notification on trace started/stopped:basic Yao Qi
2013-08-19  1:56 ` [PATCH 2/6] Add annex in an async remote notification Yao Qi
2013-09-26 18:43   ` Pedro Alves
2013-09-27  1:44     ` Yao Qi
2013-10-18  1:05       ` Yao Qi
2013-08-19  1:56 ` [PATCH 1/6] Move notif_queue to remote_state Yao Qi
2013-09-25 16:12   ` Pedro Alves
2013-09-30  7:34     ` Yao Qi
2013-09-30  7:58       ` Move pending_event to remote_notif_state ([PATCH 1/6] Move notif_queue to remote_state) Yao Qi
2013-09-30 19:34         ` Pedro Alves
2013-10-04  7:42           ` Yao Qi
2013-09-30 17:08       ` [PATCH 1/6] Move notif_queue to remote_state Pedro Alves
2013-10-01 14:08         ` Yao Qi
2013-10-02  1:54         ` Yao Qi [this message]
2013-10-02 10:48           ` Pedro Alves
2013-10-04  7:36             ` Yao Qi
2013-08-19  1:56 ` [PATCH 4/6] async remote notification 'Trace' Yao Qi
2013-08-19  1:56 ` [PATCH 3/6] Query supported notifications by qSupported Yao Qi
2013-08-19  1:56 ` [PATCH 6/6] MI notification on trace stop: triggered by remote Yao Qi
2013-09-02  0:14 ` [PATCH 0/6 V5] MI notification on trace started/stopped Yao Qi
2013-09-18 13:24 ` [ping 2]: " Yao Qi
2013-09-18 13:25   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=524B7C65.3030005@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox