public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Schilling Landgraf <dougsland@gmail.com>
To: Robert Krakora <rob.krakora@messagenetsystems.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/1] em28xx: Fix for Slow Memory Leak
Date: Tue, 14 Apr 2009 16:21:26 -0300	[thread overview]
Message-ID: <20090414162126.19aaccc9@gmail.com> (raw)
In-Reply-To: <b24e53350904141217v474222e5ye042880075bef9c4@mail.gmail.com>

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

      reply	other threads:[~2009-04-14 19:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=20090414162126.19aaccc9@gmail.com \
    --to=dougsland@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=rob.krakora@messagenetsystems.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