From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com>,
alsa-devel@alsa-project.org, lethal@linux-sh.org,
Magnus Damm <magnus.damm@gmail.com>,
linux-sh@vger.kernel.org
Subject: Re: [PATCH 1/3] Add SuperH FSI driver support for ALSA
Date: Wed, 19 Aug 2009 12:39:06 +0000 [thread overview]
Message-ID: <s5hvdkkasgl.wl%tiwai@suse.de> (raw)
In-Reply-To: <20090819122801.GC20227@rakim.wolfsonmicro.main>
At Wed, 19 Aug 2009 13:28:01 +0100,
Mark Brown wrote:
>
> > + struct snd_pcm_hw_params *hw_params)
> > +{
> > + return snd_pcm_lib_malloc_pages(substream,
> > + params_buffer_bytes(hw_params));
> > +}
>
> hw_params() may be called multiple times per stream, especially if OSS
> emulation is used. This would lead to memory leaks since if more pages
> need to be allocaeted the old buffer won't be freed. Simply calling
> free_pages() before malloc_pages() should plug this leak - free_pages()
> will check to see if anything was allocated.
Note that it's snd_pcm_lib_malloc_pages(), not the kernel's standard
one like alloc_pages(). The former frees the old buffer by itself
when resized, so you don't need to call snd_pcm_lib_free_pages()
(as long as it's called in hw_free callback).
thanks,
Takashi
next prev parent reply other threads:[~2009-08-19 12:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-19 11:25 [PATCH 1/3] Add SuperH FSI driver support for ALSA Kuninori Morimoto
2009-08-19 12:28 ` Mark Brown
2009-08-19 12:39 ` Takashi Iwai [this message]
2009-08-19 12:42 ` Mark Brown
2009-08-19 13:59 ` Magnus Damm
2009-08-19 14:44 ` Mark Brown
2009-08-20 12:11 ` Magnus Damm
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=s5hvdkkasgl.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lethal@linux-sh.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=morimoto.kuninori@renesas.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