Re: [PATCH 1/3] Add SuperH FSI driver support for ALSA

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux