* [PATCH 1/1] em28xx: Fix for Slow Memory Leak
@ 2009-04-14 19:17 Robert Krakora
2009-04-14 19:21 ` Douglas Schilling Landgraf
0 siblings, 1 reply; 2+ messages in thread
From: Robert Krakora @ 2009-04-14 19:17 UTC (permalink / raw)
To: linux-media
em28xx: Fix for Slow Memory Leak
From: Robert Krakora <rob.krakora@messagenetsystems.com>
Test Code: (Provided by Douglas)
v4l-dvb/v4l2-apps/test/stress-buffer.c
The audio DMA area was never being freed and would slowly leak over
time as the v4l device was opened and closed by an application.
Thanks again to Douglas for generating the test code to help locate
memory leaks!!!
Priority: normal
Signed-off-by: Robert Krakora <rob.krakora@messagenetsystems.com>
diff -r 5567e82c34a0 linux/drivers/media/video/em28xx/em28xx-audio.c
--- a/linux/drivers/media/video/em28xx/em28xx-audio.c Tue Mar 31
07:24:14 2009 -0300
+++ b/linux/drivers/media/video/em28xx/em28xx-audio.c Tue Apr 14
10:16:45 2009 -0400
@@ -278,6 +278,7 @@
#endif
dprintk("Allocating vbuffer\n");
+
if (runtime->dma_area) {
if (runtime->dma_bytes > size)
return 0;
@@ -385,6 +386,18 @@
mutex_lock(&dev->lock);
dev->adev.users--;
em28xx_audio_analog_set(dev);
+ if (substream == dev->adev.capture_pcm_substream)
+ {
+ if (substream && substream->runtime &&
substream->runtime->dma_area) {
+ dprintk("freeing\n");
+ vfree(substream->runtime->dma_area);
+ substream->runtime->dma_area = NULL;
+ }
+ }
+ else
+ {
+ em28xx_errdev("substream(%p) !=
dev->adev.capture_pcm_substream(%p)\n", substream,
dev->adev.capture_pcm_substream);
+ }
mutex_unlock(&dev->lock);
return 0;
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] em28xx: Fix for Slow Memory Leak
2009-04-14 19:17 [PATCH 1/1] em28xx: Fix for Slow Memory Leak Robert Krakora
@ 2009-04-14 19:21 ` Douglas Schilling Landgraf
0 siblings, 0 replies; 2+ messages in thread
From: Douglas Schilling Landgraf @ 2009-04-14 19:21 UTC (permalink / raw)
To: Robert Krakora; +Cc: linux-media
Hello Robert,
On Tue, 14 Apr 2009 15:17:16 -0400
Robert Krakora <rob.krakora@messagenetsystems.com> wrote:
> em28xx: Fix for Slow Memory Leak
Thanks, I am going to test and commit your patch.
Cheers,
Douglas
> From: Robert Krakora <rob.krakora@messagenetsystems.com>
>
> Test Code: (Provided by Douglas)
>
> v4l-dvb/v4l2-apps/test/stress-buffer.c
>
> The audio DMA area was never being freed and would slowly leak over
> time as the v4l device was opened and closed by an application.
>
> Thanks again to Douglas for generating the test code to help locate
> memory leaks!!!
>
> Priority: normal
>
> Signed-off-by: Robert Krakora <rob.krakora@messagenetsystems.com>
>
> diff -r 5567e82c34a0 linux/drivers/media/video/em28xx/em28xx-audio.c
> --- a/linux/drivers/media/video/em28xx/em28xx-audio.c Tue Mar 31
> 07:24:14 2009 -0300
> +++ b/linux/drivers/media/video/em28xx/em28xx-audio.c Tue Apr 14
> 10:16:45 2009 -0400
> @@ -278,6 +278,7 @@
> #endif
>
> dprintk("Allocating vbuffer\n");
> +
> if (runtime->dma_area) {
> if (runtime->dma_bytes > size)
> return 0;
> @@ -385,6 +386,18 @@
> mutex_lock(&dev->lock);
> dev->adev.users--;
> em28xx_audio_analog_set(dev);
> + if (substream == dev->adev.capture_pcm_substream)
> + {
> + if (substream && substream->runtime &&
> substream->runtime->dma_area) {
> + dprintk("freeing\n");
> + vfree(substream->runtime->dma_area);
> + substream->runtime->dma_area = NULL;
> + }
> + }
> + else
> + {
> + em28xx_errdev("substream(%p) !=
> dev->adev.capture_pcm_substream(%p)\n", substream,
> dev->adev.capture_pcm_substream);
> + }
> mutex_unlock(&dev->lock);
>
> return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-media" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-14 19:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14 19:17 [PATCH 1/1] em28xx: Fix for Slow Memory Leak Robert Krakora
2009-04-14 19:21 ` Douglas Schilling Landgraf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox