qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen.5i5j@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: quintela@redhat.com, QEMU Trivial <qemu-trivial@nongnu.org>,
	Michael Tokarev <mjt@tls.msk.ru>,
	dgilbert@redhat.com, QEMU Developers <qemu-devel@nongnu.org>,
	owasserm@redhat.com, arei.gonglei@huawei.com
Subject: Re: [Qemu-devel] [PATCH-trivial] arch_init.c: Free 'cache' in cache_fini() to avoid memory leak
Date: Wed, 04 Jun 2014 18:28:28 +0800	[thread overview]
Message-ID: <538EF4CC.8010703@gmail.com> (raw)
In-Reply-To: <8761kh2iok.fsf@blackfin.pond.sub.org>



On 06/04/2014 04:16 PM, Markus Armbruster wrote:
> Chen Gang <gang.chen.5i5j@gmail.com> writes:
> 
>> Call g_free() after cache_fini() in migration_end(), but do not call
>> g_free() after call cache_fini() in xbzrle_cache_resize() which will
>> cause memory leak.
>>
>> cache_init() and cache_fini() are pair, so need let cache_fini() call
>> g_free(cache) to match cache_init(), then fix current issue too.
> 
> I'm not sure I get you.  Is the following accurate?
> 
>     migration: Plug memory leak in migrate-set-cache-size command
> 
>     We call g_free() after cache_fini() in migration_end(), but we don't
>     call it after cache_fini() in xbzrle_cache_resize(), leaking the
>     memory.
> 
>     cache_init() and cache_fini() are a pair.  Since cache_init()
>     allocates the cache, let cache_fini() free it.  This plugs the leak.
> 

Yeah, and excuse me for my poor English.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

  reply	other threads:[~2014-06-04 10:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 12:16 [Qemu-devel] [PATCH-trivial] arch_init.c: Free 'cache' in cache_fini() to avoid memory leak Chen Gang
2014-06-03  7:17 ` ChenLiang
2014-06-04  8:16 ` Markus Armbruster
2014-06-04 10:28   ` Chen Gang [this message]
2014-06-04 10:54     ` Markus Armbruster
2014-06-04 11:30       ` Chen Gang
2014-06-04  9:35 ` Dr. David Alan Gilbert
2014-06-08 17:53 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev

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=538EF4CC.8010703@gmail.com \
    --to=gang.chen.5i5j@gmail.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=owasserm@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=quintela@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;
as well as URLs for NNTP newsgroup(s).